Adds v into specified rows of x. Computes y = x; y[i,] += v.
indices (Union[int, tuple]) – Indices into the left-most dimension of x, and determines which rows of x to add with v. It is an integer or a tuple, whose value is in [0, the first dimension size of x).
input_x (Tensor) - The first input is a tensor whose data type is float16, float32 or int32.
input_v (Tensor) - The second input is a tensor that has the same dimension sizes as x except the first dimension, which must be the same as indices’s size. It has the same data type with input_x.
Tensor, has the same shape and dtype as input_x.
- Supported Platforms:
>>> indices = (0, 1) >>> input_x = Tensor(np.array([[1, 2], [3, 4], [5, 6]]), mindspore.float32) >>> input_v = Tensor(np.array([[0.5, 1.0], [1.0, 1.5]]), mindspore.float32) >>> inplaceAdd = ops.InplaceAdd(indices) >>> output = inplaceAdd(input_x, input_v) >>> print(output) [[1.5 3. ] [4. 5.5] [5. 6. ]]