mindspore.ops.AccumulateNV2
- class mindspore.ops.AccumulateNV2[源代码]
逐元素将所有输入的Tensor相加。
有关更多详细信息,请参阅:
mindspore.ops.accumulate_n()
。- 支持平台:
Ascend
样例:
>>> 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.]