mindspore.ops.MaskedFill
- class mindspore.ops.MaskedFill[source]
Fills elements with value where mask is True.
Refer to
mindspore.ops.masked_fill()
for more detail.- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> input = Tensor(np.array([1., 2., 3., 4.]), mindspore.float32) >>> mask = Tensor(np.array([True, True, False, True]), mindspore.bool_) >>> output = ops.MaskedFill()(input, mask, 0.5) >>> print(output) [0.5 0.5 3. 0.5]