fix array_creations

This commit is contained in:
yanglf1121 2021-08-25 23:42:42 +08:00
parent 76a37daa43
commit e6afdeb7f9
2 changed files with 6 additions and 2 deletions

View File

@ -83,6 +83,8 @@ def array(obj, dtype=None, copy=True, ndmin=0):
>>> print(np.array([1,2,3]))
[1 2 3]
"""
if dtype is not None:
dtype = _check_dtype(dtype)
res = asarray(obj, dtype)
if ndmin > res.ndim:
@ -163,6 +165,8 @@ def asarray(a, dtype=None):
>>> print(np.asarray([1,2,3]))
[1 2 3]
"""
if dtype is not None:
dtype = _check_dtype(dtype)
if isinstance(a, Tensor):
if dtype is None or dtype == a.dtype:
return a

View File

@ -747,7 +747,7 @@ def array_equal(a1, a2, equal_nan=False):
Returns `True` if input arrays have same shapes and all elements equal.
Note:
In mindpsore, a bool tensor is returned instead, since in Graph mode, the
In mindspore, a bool tensor is returned instead, since in Graph mode, the
value cannot be traced and computed at compile time.
Since on Ascend, :class:`nan` is treated differently, currently the argument
@ -793,7 +793,7 @@ def array_equiv(a1, a2):
be broadcasted to create the same shape as the other one.
Note:
In mindpsore, a bool tensor is returned instead, since in Graph mode, the
In mindspore, a bool tensor is returned instead, since in Graph mode, the
value cannot be traced and computed at compile time.
Args: