mindspore.ops.Neg
- class mindspore.ops.Neg[source]
Returns a tensor with negative values of the input tensor element-wise.
Refer to
mindspore.ops.neg()
for more detail.- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> neg = ops.Neg() >>> x = Tensor(np.array([1, 2, -1, 2, 0, -3.5]), mindspore.float32) >>> output = neg(x) >>> print(output) [-1. -2. 1. -2. 0. 3.5]