mindspore.ops.AccumulateNV2

View Source On AtomGit
class mindspore.ops.AccumulateNV2[source]

ops.AccumulateNV2 is deprecated from version 2.8.0 and will be removed in a future version, please use mindspore.ops.addn() instead.

Computes accumulation of all input tensors element-wise.

Refer to mindspore.ops.addn() for more details.

Supported Platforms:

Deprecated

Examples

>>> import mindspore
>>> import numpy as np
>>> from mindspore import Tensor, ops, nn
>>> 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.]