mindspore.ops.scatter_min
- mindspore.ops.scatter_min(input_x, indices, updates)[source]
Perform a minimum update on input_x based on the specified indices and update values.
\[\text{input_x}[\text{indices}[i, ..., j], :] = \min(\text{input_x}[\text{indices}[i, ..., j], :], \text{updates}[i, ..., j, :])\]Note
Support implicit type conversion and type promotion.
Since Parameter objects do not support type conversion, an exception will be thrown when input_x is of a low-precision data type.
The shape of updates is indices.shape + input_x.shape[1:].
- Parameters
- Returns
Tensor
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> import mindspore >>> input_x = mindspore.Parameter(mindspore.tensor(mindspore.ops.zeros((2, 3)), ... mindspore.float32), name="input_x") >>> indices = mindspore.tensor([1, 0], mindspore.int32) >>> update = mindspore.tensor(mindspore.ops.arange(0, 6).reshape((2, 3)), mindspore.float32) >>> output = mindspore.ops.scatter_min(input_x, indices, update) >>> print(output) [[0. 0. 0.] [0. 0. 0.]]