Implementing kernel
C++ engine symbols that back this Python API.Predicate: do two tensors have the same shape and the same elements?
One Python bool for the whole pair, unlike the element-wise
lucid.eq. The shapes must match exactly — no broadcasting —
and the elements are compared at the pair's promoted dtype, so an
integer tensor equals the float tensor holding the same values.
Parameters
Returns
boolTrue iff input.shape == other.shape and every element pair
compares equal. NaN equals nothing, itself included, and
-0.0 equals 0.0. Two empty tensors of one shape are equal.
Raises
TypeErrorIf either argument is not a
Tensor.Notes
Reading the answer synchronises any pending Metal work on the pair.
Examples
>>> import lucid
>>> lucid.equal(lucid.tensor([1, 2]), lucid.tensor([1.0, 2.0]))
True
>>> lucid.equal(lucid.tensor([1, 2]), lucid.tensor([[1, 2]]))
False