mindspore.ops.tensor_scatter_mul

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

Return a new tensor by performing a multiplication update on input_x at the specified indices with the given update values.

output[indices]=input_x×update

Note

  • If some values of the indices are out of bound, instead of raising an index error, the corresponding updates will not be updated to input_x.

Parameters
  • input_x (Tensor) – The input tensor.

  • indices (Tensor) – The specified indices. The rank must be at least 2.

  • updates (Tensor) – The update values.

Returns

Tensor

Supported Platforms:

GPU CPU

Examples

>>> import mindspore
>>> input_x = mindspore.tensor([[1, 2, 3], [4, 5, 6]])
>>> indices = mindspore.tensor([[0, 0], [1, 1]])
>>> updates = mindspore.tensor([5, 5])
>>> mindspore.ops.tensor_scatter_mul(input_x, indices, updates)
Tensor(shape=[2, 3], dtype=Int64, value=
[[ 5,  2,  3],
 [ 4, 25,  6]])