mindspore.Tensor.abs

Tensor.abs()[source]

Return absolute value element-wisely.

Returns

Tensor.

Supported Platforms:

Ascend GPU CPU

Examples

>>> from mindspore import Tensor
>>> a = Tensor([1.1, -2.1]).astype("float32")
>>> output = a.abs()
>>> print(output)
[1.1 2.1]