giagrad.Tensor.hardswish#
- Tensor.hardswish() Tensor [source]#
Creates a new Tensor applying Hard Swish function to data. See Hard Swish.
\[out_i = data_i \, \times \, \frac{\text{ReLU6}(data_i + 3)}{6}\]Examples
>>> t = Tensor.empty(2, 4).uniform(-5, 5) >>> t tensor: [[-4.0175104 3.993501 -1.0318986 -0.30065283] [-2.4765007 -1.3878915 1.7888396 4.3194094 ]] >>> t.hardswish() tensor: [[-0. 3.993501 -0.3384802 -0.13526106] [-0.21607438 -0.37290528 1.4277442 4.3194094 ]] fn: Hardswish