计算输入input的相反数并返回。
input (Tensor) - 输入tensor。
Tensor
Ascend GPU CPU
Ascend
GPU
CPU
样例:
>>> import mindspore >>> input = mindspore.tensor([1, 2, -1, 2, 0, -3.5], mindspore.float32) >>> output = mindspore.ops.neg(input) >>> print(output) [-1. -2. 1. -2. 0. 3.5]