评价此页

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