mindspore.mint.abs

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

Compute the absolute value of a tensor element-wise.

outi=|inputi|
Parameters

input (Tensor) – The input tensor.

Returns

Tensor

Supported Platforms:

Ascend

Examples

>>> import mindspore
>>> output = mindspore.mint.abs(mindspore.tensor([-1.0, 1.0, 0.0])))
>>> print(output)
[1. 1. 0.]