oneflow.abs¶
-
oneflow.
abs
()¶ Return the absolute value of each element in input tensor:math:y = |x| element-wise.
- Parameters
input (Tensor) – the input tensor.
For example:
>>> import oneflow as flow >>> import numpy as np >>> x = flow.tensor(np.array([-1, 2, -3, 4]).astype(np.float32)) >>> flow.abs(x) tensor([1., 2., 3., 4.], dtype=oneflow.float32)