Skip to content

Commit df8e766

Browse files
authored
fix diffusers omni ut (#2091)
1 parent 583bf96 commit df8e766

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

mindnlp/core/_tensor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ def bitwise_or_(self, other):
491491
StubTensor.reshape = ops.reshape
492492

493493
def __rmul__(self, other):
494-
if isinstance(other, str):
494+
if isinstance(other, (str, list)):
495495
return self.item() * other
496496
return self.__mul__(other)
497497

mindnlp/core/ops/creation.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,15 @@ def ones(*size, dtype=None, device=None, **kwargs):
9090
dtype = get_default_dtype()
9191
if not isinstance(dtype, Type):
9292
dtype = py2dtype[dtype]
93+
94+
new_size = ()
95+
for s in size:
96+
if not isinstance(s, int):
97+
s = s.item()
98+
new_size += (s,)
9399
if use_pyboost() and has_ones:
94-
return mindspore.mint.ones(size, dtype=dtype)
95-
return _ones(size, dtype)
100+
return mindspore.mint.ones(new_size, dtype=dtype)
101+
return _ones(new_size, dtype)
96102

97103
# ones_like
98104
has_ones_like = hasattr(mindspore.mint, 'ones_like')

0 commit comments

Comments
 (0)