()
return Fn('HardTanh', lambda x: jnp.maximum(-1, jnp.minimum(1, x)))
r"""Returns a layer that computes a linear approximation to `Tanh`.

  .. math::
      f(x) = \left\{ \begin{array}{cl}
          -1 & \text{if}\ x \leq -1, \\
          x  & \text{if}\ -1 < x < 1, \\
          1  & \text{otherwise}.
      \end{array} \right.
r"""Returns a layer that computes a linear approximation to `Tanh`.
r Returns a layer that computes a linear approximation to Tanh .
def HardTanh():
  r"""Returns a layer that computes a linear approximation to `Tanh`.

  .. math::
      f(x) = \left\{ \begin{array}{cl}
          -1 & \text{if}\ x \leq -1, \\
          x  & \text{if}\ -1 < x < 1, \\
          1  & \text{otherwise}.
      \end{array} \right.
  """
  return Fn('HardTanh', lambda x: jnp.maximum(-1, jnp.minimum(1, x)))
def HardTanh ( ) : return Fn ( 'HardTanh' , lambda x : jnp . maximum ( - 1 , jnp . minimum ( 1 , x ) ) )