mindspore.ops.tensor_scatter_div

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

Return a new tensor which input_x is divided by the values from updates indicated by indices .

\[output\left [indices \right ] = input\_x \div update\]

Note

  • On GPU, if some values of the indices are out of bound, instead of raising an index error, the corresponding updates will not be updated to self tensor.

  • On CPU, if some values of the indices are out of bound, raising an index error.

  • On Ascend, out of bound checking is not supported, if some values of the indices are out of bound, unknown errors may be caused.

  • The operator can't handle division by 0 exceptions, so the user needs to make sure there is no 0 value in updates.

Parameters
  • input_x (Tensor) – The input tensor.

  • indices (Tensor) – The specified indices.

  • updates (Tensor) – The update values.

Returns

Tensor

Supported Platforms:

GPU CPU

Examples

>>> import mindspore
>>> input_x = mindspore.tensor([[-0.1, 0.3, 3.6], [0.4, 0.5, -3.2]], mindspore.float32)
>>> indices = mindspore.tensor([[0, 0], [0, 0]], mindspore.int32)
>>> updates = mindspore.tensor([1.0, 2.0], mindspore.float32)
>>> output = mindspore.ops.tensor_scatter_div(input_x, indices, updates)
>>> print(output)
[[-0.05  0.3  3.6  ]
 [ 0.4   0.5  -3.2 ]]