mindspore.ops.scatter_min

View Source On Gitee
mindspore.ops.scatter_min(input_x, indices, updates)[source]

Perform a minimum update on input_x based on the specified indices and update values.

input_x[indices[i,...,j],:]=min(input_x[indices[i,...,j],:],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
  • input_x (Union[Parameter, Tensor]) – The input parameter or tensor.

  • indices (Tensor) – The specified indices.

  • updates (Tensor) – The update values.

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.]]