torch.nn.functional.hardswish

torch.nn.functional.hardswish(input, inplace=False)[源代码]

对每个元素应用hardswish函数。

根据论文所述进行实现:搜索MobileNetV3

$\text{Hardswish}(x) = \begin{cases} 0 & \text{if~} x \le -3, \\ x & \text{if~} x \ge +3, \\ x \cdot (x + 3) /6 & \text{otherwise} \end{cases}$

更多详情请参见Hardswish

返回类型

Tensor

本页目录