fn
eq
→Tensoreq(input: Tensor, other: Tensor | Scalar)Element-wise equality predicate.
Element-wise comparison with broadcasting; the result is a boolean tensor that
is True where input equals other and False elsewhere. Python
scalars on either side are promoted to a matching tensor before the comparison.
Parameters
inputTensorLeft operand.
otherTensor or scalarRight operand. Broadcasts against
input.Returns
TensorBoolean tensor (dtype bool) with shape broadcast(input.shape, other.shape).
Notes
Mathematical definition:
Floating-point comparison is exact bit-pattern equality / strict ordering;
NaN entries are never equal to anything and produce False for ordering
predicates. For tolerance-based comparison use isclose. Comparison
operations are not differentiable; gradients passed to them are dropped.
Examples
>>> import lucid
>>> a = lucid.tensor([1.0, 2.0, 3.0])
>>> b = lucid.tensor([1.0, 5.0, 2.0])
>>> lucid.eq(a, b)
Tensor([...])