class HardTanh

class HardTanh

HardTanh defined as.

\[\begin{split} y_i = 1 \text{ if } x_i > 1\\ y_i = -1 \text{ if } x_i < -1\\ y_i = x \text{, otherwise} \end{split}\]

Inputs:

  • N-D array.

Outputs:

  • N-D array.

Template Parameters:

T – Data type for computation.