Python wrappers
Public Python APIs implemented by this engine symbol.Element-wise equality comparison.
Computes out[i] = (a[i] == b[i]) for every element and returns the
result as a Bool tensor. The comparison is exact, so for floating-point
inputs it follows IEEE 754 equality (NaN == NaN is false).
Non-differentiable: the comparison function has zero gradient almost everywhere and undefined gradient on the decision boundary, so no autograd node is registered and the output never carries grad.
Math
References
NumPy numpy.equal.
See Also
not_equal_op, less_op, greater_op
Parameters
a, bTensorImplPtrOperands. Must have identical shape, dtype, and device — this op does not broadcast.
Returns
TensorImplPtrBool tensor with the same shape as a and b.
Raises
LucidErrorIf the operand shapes, dtypes, or devices differ.
Notes
- Output dtype is always
Boolregardless of input dtype. - No broadcasting — callers must align shapes upstream.
Examples
auto a = tensor({1, 2, 3});
auto b = tensor({1, 0, 3});
auto m = equal_op(a, b); // Bool[true, false, true]