Tensor.hardtanh()
Returns the hardtanh of the elements of input tensor element-wise.
Usage
from tinygrad.tensor import Tensor
tensor = Tensor([-1, -5, 1, 2, 3, 4, 5])
tensor = tensor.hardtanh()
print(tensor.numpy())
Return value
[-1. -1. 1. 1. 1. 1. 1.]