From e6afdeb7f95e630d5c3736eb2220b6ad78d4eaa3 Mon Sep 17 00:00:00 2001 From: yanglf1121 Date: Wed, 25 Aug 2021 23:42:42 +0800 Subject: [PATCH] fix array_creations --- mindspore/numpy/array_creations.py | 4 ++++ mindspore/numpy/logic_ops.py | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/mindspore/numpy/array_creations.py b/mindspore/numpy/array_creations.py index 90a2b7f8ab0..25e997deb34 100644 --- a/mindspore/numpy/array_creations.py +++ b/mindspore/numpy/array_creations.py @@ -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 diff --git a/mindspore/numpy/logic_ops.py b/mindspore/numpy/logic_ops.py index bc12a39ecb2..8d00660737d 100644 --- a/mindspore/numpy/logic_ops.py +++ b/mindspore/numpy/logic_ops.py @@ -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: