mindspore.numpy.negative

mindspore.numpy.negative(a, dtype=None)[源代码]

Numerical negative, element-wise.

说明

Numpy arguments out, where, casting, order, subok, signature, and extobj are not supported.

参数
  • a (Tensor) – Input tensor.

  • dtype (mindspore.dtype, optional) – Defaults to None. Overrides the dtype of the output Tensor.

返回

Tensor.

Supported Platforms:

Ascend GPU CPU

样例

>>> import mindspore.numpy as np
>>> a = np.asarray([1, -1]).astype('float32')
>>> output = np.negative(a)
>>> print(output)
[-1. 1.]