giagrad.Tensor.relu6#

Tensor.relu6() Tensor[source]#

Applies a modified version of ReLU with maximum size of 6. See ReLU6.

\[out_i = \min(\max(0, x), 6)\]

Examples

>>> t = Tensor.empty(2, 3).uniform(-1, 20)
>>> t
tensor: [[11.792983   -0.20050316 15.441884  ]
         [ 3.5337465  13.230399    9.813518  ]]
>>> t.relu6()
tensor: [[6.        0.        6.       ]
         [3.5337465 6.        6.       ]] fn: ReLU6