# hardtanh¶

paddle.nn.functional. hardtanh ( x, min=- 1.0, max=1.0, name=None ) [source]

hardtanh activation

$\begin{split}hardtanh(x)= \left\{ \begin{array}{cll} max,& & \text{if } x > max \\ min,& & \text{if } x < min \\ x,& & \text{otherwise} \end{array} \right.\end{split}$
Parameters
• x (Tensor) – The input Tensor with data type float32, float64.

• min (float, optional) – The minimum value of the linear region range. Default is -1.

• max (float, optional) – The maximum value of the linear region range. Default is 1.

• name (str, optional) – Name for the operation (optional, default is None). For more information, please refer to Name.

Returns

A Tensor with the same data type and shape as x .

Examples

import paddle