Tensor.abs()
Returns a new tensor with the absolute value of the elements of input tensor.
Usage
from tinygrad.tensor import Tensor
tensor = Tensor([-2, 1, 2, 3, 4, 5, 6])
tensor = tensor.abs()
print(tensor.numpy())
Return value
[2. 1. 2. 3. 4. 5. 6.]