megengine.functional.nn.hswish

hswish(x)[源代码]

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

示例

import numpy as np
from megengine import tensor
import megengine.functional as F

x = tensor(np.arange(5).astype(np.float32))
out = F.hswish(x)
print(out.numpy().round(decimals=4))
[0.     0.6667 1.6667 3.     4.    ]