mlx.nn.softshrink

Contents

mlx.nn.softshrink#

class softshrink(x, lambd: float = 0.5)#

Applies the Softshrink activation function.

\[\begin{split}\text{softshrink}(x) = \begin{cases} x - \lambda & \text{if } x > \lambda \\ x + \lambda & \text{if } x < -\lambda \\ 0 & \text{otherwise} \end{cases}\end{split}\]