megengine.functional.hswish

hswish(x)[源代码]

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

参数

x – 输入张量。

返回

计算得到的张量。

例如:

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.    ]