硬件加速 ¶
-
class torch.nn.Hardswish(inplace=False)[source][source]
逐元素应用 Hardswish 函数。
方法见论文:寻找 MobileNetV3。
Hardswish 定义为:
Hardswish(x)=⎩⎨⎧0xx⋅(x+3)/6if x≤−3,if x≥+3,otherwise
- 参数:
inplace(布尔值)- 可选地进行原地操作。默认: False
- 形状:
-
示例:
>>> m = nn.Hardswish()
>>> input = torch.randn(2)
>>> output = m(input)