latest (dev)
Copy
Latest development documentation · Updated 2026-10-15
tensorplay.functional.equal
- tensorplay.functional.equal(input, other) bool[source]
Trueif two tensors have the same size and elements,Falseotherwise.Note
Tensors containing NaNs are never equal to each other. Additionally, this function does not differentiate between the data types of the tensors during comparison. For more thorough tensor checks, use
tensorplay.testing.assert_close().Example:
>>> tensorplay.equal(tensorplay.tensor([1, 2]), tensorplay.tensor([1, 2])) True >>> tensorplay.equal(tensorplay.tensor([3, tensorplay.nan]), tensorplay.tensor([3, tensorplay.nan])) False >>> tensorplay.equal(tensorplay.tensor([1, 2, 3], dtype=tensorplay.int32), tensorplay.tensor([1, 2, 3], dtype=tensorplay.float32)) True
Help improve this page
Found an error, an unclear step, or a missing example?
Was this page helpful?

