torch.Tensor.masked_scatter_¶
-
Tensor.
masked_scatter_
(mask, source)¶ Copies elements from
source
intoself
tensor at positions where themask
is True. The shape ofmask
must be broadcastable with the shape of the underlying tensor. Thesource
should have at least as many elements as the number of ones inmask
- Parameters
mask (BoolTensor) – the boolean mask
source (Tensor) – the tensor to copy from
Note
The
mask
operates on theself
tensor, not on the givensource
tensor.