mindspore.ops.scatter_max
- mindspore.ops.scatter_max(input_x, indices, updates)[source]
Perform a maximum update on input_x based on the specified indices and update values.
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([[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]], ... mindspore.float32), name="input_x") >>> indices = mindspore.tensor([[0, 0], [1, 1]], mindspore.int32) >>> updates = mindspore.tensor(mindspore.ops.ones([2, 2, 3]) * 88, mindspore.float32) >>> output = mindspore.ops.scatter_max(input_x, indices, updates) >>> print(output) [[88. 88. 88.] [88. 88. 88.]]