!20988 fix the wrong output of the MulNoNan and Minimum example

Merge pull request !20988 from dinglinhe/code_docs_dlh_ms_I42F60
This commit is contained in:
i-robot 2021-07-28 11:38:14 +00:00 committed by Gitee
commit 0660666459
1 changed files with 3 additions and 3 deletions

View File

@ -2308,14 +2308,14 @@ class Minimum(_MathBinaryOp):
>>> # case 1 : same data type >>> # case 1 : same data type
>>> x = Tensor(np.array([1.0, 5.0, 3.0]), mindspore.float32) >>> x = Tensor(np.array([1.0, 5.0, 3.0]), mindspore.float32)
>>> y = Tensor(np.array([4.0, 2.0, 6.0]), mindspore.float32) >>> y = Tensor(np.array([4.0, 2.0, 6.0]), mindspore.float32)
>>> minimum = ops.Minimum() >>> minimum = ops.Minimum
>>> output = minimum(x, y) >>> output = minimum(x, y)
>>> print(output) >>> print(output)
[1. 2. 3.] [1. 2. 3.]
>>> # case 2 : different data type >>> # case 2 : different data type
>>> x = Tensor(np.array([1.0, 5.0, 3.0]), mindspore.int32) >>> x = Tensor(np.array([1.0, 5.0, 3.0]), mindspore.int32)
>>> y = Tensor(np.array([4.0, 2.0, 6.0]), mindspore.float32) >>> y = Tensor(np.array([4.0, 2.0, 6.0]), mindspore.float32)
>>> output = Minimum(x, y) >>> output = minimum(x, y)
>>> print(output.dtype) >>> print(output.dtype)
Float32 Float32
""" """
@ -2596,7 +2596,7 @@ class MulNoNan(_MathBinaryOp):
Float32 Float32
>>> # case 3 : the y is a scalar. >>> # case 3 : the y is a scalar.
>>> x = Tensor(np.array([[-1.0, 6.0, 0], [0, np.nan, 4.0]]), mindspore.float32) >>> x = Tensor(np.array([[-1.0, 6.0, 0], [0, np.nan, 4.0]]), mindspore.float32)
>>> y = Tensor(0, [np.nan, 0, 1.0]]), mindspore.float32) >>> y = Tensor(0, mindspore.float32)
>>> output = mul_no_nan(x, y) >>> output = mul_no_nan(x, y)
>>> print(output) >>> print(output)
[[ 0. 0. 0.] [[ 0. 0. 0.]