PaddlePaddle

 paddle.fluid / layers / hard_shrink


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激活函数的输出

代码示例

import paddle.fluid as fluid
data = fluid.layers.data(name="input", shape=[784])
result = fluid.layers.hard_shrink(x=data, threshold=0.3)

此页内容是否对您有帮助