softshrink

paddle.fluid.layers.softshrink(x, alpha=None)[source]

Softshrink Activation Operator

\[\begin{split}out = \begin{cases} x - \alpha, \text{if } x > \alpha \\ x + \alpha, \text{if } x < -\alpha \\ 0, \text{otherwise} \end{cases}\end{split}\]
Parameters
  • x – Input of Softshrink operator, an N-D Tensor, with data type float32, float64 or float16.

  • alpha (float) – non-negative offset

Returns

Output of Softshrink operator with the same type of input.

Examples

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