设计
规格
API
API映射
迁移指南
FAQ
RELEASE NOTES
逐元素计算输入Tensor的绝对值。
x (Tensor) - 输入Tensor。T其shape为 (N,∗) ,其中 ∗ 表示任意数量的附加维度。
Tensor,shape与 x 相同。
TypeError - 如果 x 不是Tensor。
Ascend GPU CPU
Ascend
GPU
CPU
样例:
>>> x = Tensor(np.array([-1.0, 1.0, 0.0]), mindspore.float32) >>> output = ops.abs(x) >>> print(output) [1. 1. 0.]