mindspore.mint.allclose
- mindspore.mint.allclose(input, other, rtol=1e-05, atol=1e-08, equal_nan=False)[source]
Return whether each element of input is “close” to the corresponding element of other. Closeness is defined as:
\[|input-other| ≤ atol + rtol × |other|\]Warning
This is an experimental API that is subject to change or deletion.
- Parameters
input (Tensor) – The first input tensor.
other (Tensor) – The second input tensor.
rtol (Union[float, int, bool], optional) – Relative tolerance. Default
1e-05.atol (Union[float, int, bool], optional) – Absolute tolerance. Default
1e-08.equal_nan (bool, optional) – Whether two NaNs are considered equal. Default
False.
- Returns
A bool scalar.
- Supported Platforms:
Ascend
Examples
>>> import mindspore >>> import numpy as np >>> input = mindspore.tensor(np.array([1.3, 2.1, 3.2, 4.1, 5.1]), mindspore.float16) >>> other = mindspore.tensor(np.array([1.3, 3.3, 2.3, 3.1, 5.1]), mindspore.float16) >>> output = mindspore.mint.allclose(input, other) >>> print(output) False