mindspore.mint.neg

View Source On Gitee
mindspore.mint.neg(input)[source]

Returns a tensor with negative values of the input tensor element-wise.

outi=inputi
Parameters

input (Tensor) – The input tensor.

Returns

Tensor

Supported Platforms:

Ascend

Examples

>>> import mindspore
>>> input = mindspore.tensor([1, 2, -1, 2, 0, -3.5], mindspore.float32)
>>> output = mindspore.mint.neg(input)
>>> print(output)
[-1.  -2.   1.  -2.   0.   3.5]