# Softshrink Activation Function

A Softshrink Activation Function is a neuron activation function that is based on the piecewise linear function $f(x) = \begin{cases} x-\lambda & \mbox{ if } x \gt 0 \\ x+\lambda &\mbox{ if } x \lt 0 \\ 0 &\mbox{ otherwise } \end{cases}$ .

## References

### 2018a

f(x) = x-lambda, if x > lambda
f(x) = x+lambda, if x < -lambda
f(x) = 0, otherwise

Parameters: lambd – the lambda value for the Softshrink formulation. Default: 0.5

Shape:

• Input: $(N,∗)$ where * means, any number of additional dimensions
• Output: $(N,∗)$, same shape as the input
Examples:
>>> m = nn.Softshrink()

forward(input) source
Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.