mindspore.ops.tensor_scatter_div
- mindspore.ops.tensor_scatter_div(input_x, indices, updates)[source]
Return a new tensor in which input_x is divided by the values from updates indicated by indices .
\[output\left [indices \right ] = input\_x \div updates\]Note
On GPU, if some values of the indices are out of bounds, 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 bounds, an index error will be raised.
On Ascend, out of bounds checking is not supported, if some values of the indices are out of bounds, 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
- Returns
Tensor
- Supported Platforms:
GPUCPU
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 ]]