hard_shrink

paddle.fluid.layers. hard_shrink ( x, threshold=None )

HardShrink激活函数(HardShrink activation operator)

\[\begin{split}out = \begin{cases} x, \text{if } x > \lambda \\ x, \text{if } x < -\lambda \\ 0, \text{otherwise} \end{cases}\end{split}\]

参数

  • x - HardShrink激活函数的输入

  • threshold (FLOAT)-HardShrink激活函数的threshold值。[默认:0.5]

返回

HardShrink激活函数的输出

代码示例

COPY-FROM: paddle.fluid.layers.hard_shrink