mindspore.Tensor.isclose

查看源文件
mindspore.Tensor.isclose(x2, rtol=1e-05, atol=1e-08, equal_nan=False)

详情请参考 mindspore.ops.isclose()

支持平台:

Ascend GPU CPU

样例:

>>> import mindspore
>>> import numpy as np
>>> from mindspore import Tensor
>>> input = Tensor(np.array([1.3, 2.1, 3.2, 4.1, 5.1]), mindspore.float16)
>>> other = Tensor(np.array([1.3, 3.3, 2.3, 3.1, 5.1]), mindspore.float16)
>>> output = Tensor.isclose(input, other)
>>> print(output)
[ True False False False  True]