mindspore.Tensor.add_

View Source On Gitee
Tensor.add_(other, *, alpha=1)[source]
inplace update self by following compute:

self = self + other * alpha.

Warning

This is an experimental API that is subject to change or deletion. The other tensor must be broadcastable with the self tensor. It may be of a different data type.

Parameters
  • other (Tensor) – the source tensor Add to self Tensor.

  • alpha (Number) – no effect currently.

Returns

Return self Tensor.

Supported Platforms:

Ascend

Examples

>>> import numpy as np
>>> from mindspore import Tensor
>>> a = Tensor(np.ones((2,3)).astype("float32"))
>>> b = Tensor(np.ones((2,3)).astype("float32"))
>>> a.add_(b)
>>> print(a)
[[2. 2. 2.]
[2. 2. 2.]]