# tensorplay.functional.allclose Source: https://www.tensorplay.cn/docs/generated/tensorplay.functional.allclose.html ```python tensorplay.functional.allclose(input: Tensor, other: Tensor, rtol: float = 1e-05, atol: float = 1e-08, equal_nan: bool = False) → bool ``` This function checks if input and other satisfy the condition: $$\lvert \text{input}_i - \text{other}_i \rvert \leq \texttt{atol} + \texttt{rtol} \times \lvert \text{other}_i \rvert$$ elementwise, for all elements of input and other. The behaviour of this function is analogous to [numpy.allclose](https://numpy.org/doc/stable/reference/generated/numpy.allclose.html) Parameters: - input ([Tensor](/docs/generated/tensorplay.Tensor.html#tensorplay.Tensor)) – first tensor to compare - other ([Tensor](/docs/generated/tensorplay.Tensor.html#tensorplay.Tensor)) – second tensor to compare - atol ([float](https://docs.python.org/3/builtins/functions.html#float), optional) – absolute tolerance. Default: 1e-08 - rtol ([float](https://docs.python.org/3/builtins/functions.html#float), optional) – relative tolerance. Default: 1e-05 - equal_nan ([bool](https://docs.python.org/3/builtins/functions.html#bool), optional) – if True, then two NaN s will be considered equal. Default: False Example: ``` >>> tensorplay.allclose(tensorplay.tensor([10000., 1e-07]), tensorplay.tensor([10000.1, 1e-08])) False >>> tensorplay.allclose(tensorplay.tensor([10000., 1e-08]), tensorplay.tensor([10000.1, 1e-09])) True >>> tensorplay.allclose(tensorplay.tensor([1.0, float('nan')]), tensorplay.tensor([1.0, float('nan')])) False >>> tensorplay.allclose(tensorplay.tensor([1.0, float('nan')]), tensorplay.tensor([1.0, float('nan')]), equal_nan=True) True ```