Skip to content

Latest commit

 

History

History
43 lines (20 loc) · 753 Bytes

hard_shrink_cn.rst

File metadata and controls

43 lines (20 loc) · 753 Bytes

hard_shrink

HardShrink激活函数(HardShrink activation operator)

$$\begin{aligned} out = \begin{cases} x, \text{if } x > \lambda \\\ x, \text{if } x < -\lambda \\\ 0, \text{otherwise} \end{cases} \end{aligned}$$

参数:
  • 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)