mindspore.ops.IsClose
- class mindspore.ops.IsClose(rtol=1e-05, atol=1e-08, equal_nan=False)[source]
Returns a tensor of Boolean values indicating whether each element of input is "close" to the corresponding element of other. Closeness is defined as:
\[|input-other| <= atol + rtol * |other|\]Refer to
mindspore.ops.isclose()
for more details.- Parameters
- Inputs:
input (Tensor) - First tensor to compare.
other (Tensor) - Second tensor to compare.
- Outputs:
Tensor, with the same shape as input and other after broadcasting, its dtype is bool.
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> import mindspore >>> import numpy as np >>> from mindspore import Tensor >>> from mindspore.ops import IsClose >>> 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) >>> isclose = IsClose() >>> output = isclose(input, other) >>> print(output) [ True False False False True]