Implementing kernel
C++ engine symbols that back this Python API.Return a 1-D tensor of elements where mask is True.
The mask must be broadcast-compatible with input. The output is
always rank 1 regardless of input rank — ordering follows row-major
traversal.
Parameters
Returns
Tensor1-D tensor of length mask.sum().item().
Notes
Because the output size is data-dependent this operation may force
a host round-trip on accelerator backends; prefer where when
a fixed-shape result is acceptable.
Examples
>>> import lucid
>>> x = lucid.tensor([[1, 2], [3, 4]])
>>> m = x > 2
>>> lucid.masked_select(x, m)
Tensor([3, 4])