TensorPlay
latest (dev)
Copy
View Markdown

Latest development documentation · Updated 2026-10-15

tensorplay.functional.equal

tensorplay.functional.equal(input, other) → bool[source]

True if two tensors have the same size and elements, False otherwise.

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

On this page

Ask DeepWiki