Implementing kernel
C++ engine symbols that back this Python API.Return input with positions where mask is True set to value.
The mask must be broadcast-compatible with input. Out-of-place:
a fresh tensor is returned; input is not modified.
Parameters
Returns
TensorTensor of the same shape and dtype as input.
Notes
Often used to apply attention masks:
Examples
>>> import lucid
>>> x = lucid.tensor([1.0, 2.0, 3.0])
>>> m = lucid.tensor([True, False, True])
>>> lucid.masked_fill(x, m, 0.0)
Tensor([0., 2., 0.])