Implementing kernel
C++ engine symbols that back this Python API.Elementwise selection between x and y based on cond.
For each element position the result is x where cond is
True and y otherwise. All three inputs broadcast against each
other.
Parameters
Returns
TensorTensor of the broadcast shape.
Notes
Mathematically,
Differentiable through both x and y — the gradient is gated
by cond.
Examples
>>> import lucid
>>> a = lucid.tensor([1.0, 2.0, 3.0])
>>> b = lucid.tensor([-1.0, -2.0, -3.0])
>>> lucid.where(a > 1.5, a, b)
Tensor([-1., 2., 3.])