megengine.functional.nn.hswish

hswish(x)[源代码]

逐元素计算 x * relu6(x + 3) / 6。

示例

>>> import numpy as np
>>> x = Tensor(np.arange(5).astype(np.float32))
>>> out = F.hswish(x)
>>> out.numpy().round(decimals=4)
array([0.    , 0.6667, 1.6667, 3.    , 4.    ], dtype=float32)