评价此页

torch.nn.functional.hardsigmoid#

torch.nn.functional.hardsigmoid(input, inplace=False)[source]#

将 Hardsigmoid 函数逐元素应用。

Hardsigmoid(x)={0if x3,1if x+3,x/6+1/2otherwise\text{Hardsigmoid}(x) = \begin{cases} 0 & \text{if~} x \le -3, \\ 1 & \text{if~} x \ge +3, \\ x / 6 + 1 / 2 & \text{otherwise} \end{cases}
参数

inplace (bool) – 如果设置为 True,则原地执行此操作。默认为 False

返回类型

张量

更多详情请参阅 Hardsigmoid