fn
logical_xor
→Tensorlogical_xor(input: Tensor, other: Tensor | Scalar)Element-wise logical exclusive-OR.
Element-wise boolean operation. Non-boolean inputs are first reduced to their
truthiness (False iff the value is exactly zero) before the operation is
applied. The output dtype is bool.
Parameters
inputTensorLeft operand (treated as boolean).
otherTensor or scalarRight operand (treated as boolean). Broadcasts against
input.Returns
TensorBoolean tensor with shape broadcast(input.shape, other.shape).
Notes
Mathematical definition (with denoting boolean coercion):
Logical operations are not differentiable; gradients are dropped. Equivalent to input.bool() ^ other.bool().
Examples
>>> import lucid
>>> a = lucid.tensor([True, False, True])
>>> b = lucid.tensor([True, True, False])
>>> lucid.logical_xor(a, b)
Tensor([...])