mindspore.ops.AccumulateNV2
- class mindspore.ops.AccumulateNV2[source]
Computes accumulation of all input tensors element-wise.
Refer to
mindspore.ops.accumulate_n()
for more details.- Inputs:
x (Union(tuple[Tensor], list[Tensor])) - The input tuple or list is made up of multiple tensors whose dtype is number to be added together. Each element of tuple or list should have the same shape.
- Outputs:
Tensor, has the same shape and dtype as each entry of the x.
- Supported Platforms:
Ascend
GPU
Examples
>>> class NetAccumulateNV2(nn.Cell): ... def __init__(self): ... super(NetAccumulateNV2, self).__init__() ... self.accumulateNV2 = ops.AccumulateNV2() ... ... def construct(self, *z): ... return self.accumulateNV2(z) ... >>> net = NetAccumulateNV2() >>> x = Tensor(np.array([1, 2, 3]), mindspore.float32) >>> y = Tensor(np.array([4, 5, 6]), mindspore.float32) >>> output = net(x, y, x, y) >>> print(output) [10. 14. 18.]