latest (dev)
Copy
Latest development documentation · Updated 2026-10-15
tensorplay.functional.isclose
- tensorplay.functional.isclose(input, other, rtol=1e-05, atol=1e-08, equal_nan=False) Tensor[source]
Returns a new tensor with boolean elements representing if each element of
inputis “close” to the corresponding element ofother. Closeness is defined as:where
inputandotherare finite. Whereinputand/orotherare nonfinite they are close if and only if they are equal, with NaNs being considered equal to each other whenequal_nanis True.- Parameters:
Examples:
>>> tensorplay.isclose(tensorplay.tensor((1., 2, 3)), tensorplay.tensor((1 + 1e-10, 3, 4))) tensor([ True, False, False]) >>> tensorplay.isclose(tensorplay.tensor((float('inf'), 4)), tensorplay.tensor((float('inf'), 6)), rtol=.5) tensor([True, True])
Help improve this page
Found an error, an unclear step, or a missing example?
Was this page helpful?

