mindspore.Tensor.neg

查看源文件
mindspore.Tensor.neg()

详情请参考 mindspore.ops.neg()

支持平台:

Ascend GPU CPU

样例:

>>> import mindspore
>>> import numpy as np
>>> from mindspore import Tensor
>>> input = Tensor(np.array([1, 2, -1, 2, 0, -3.5]), mindspore.float32)
>>> output = input.neg()
>>> print(output)
[-1.  -2.   1.  -2.   0.   3.5]