relu6(x, threshold=6.0, name=None)
Relu6 Activation Operator.
$$out = min(max(0, x), threshold)$$
x (Variable) – Input of relu6 operator, an N-D Tensor, with data type float32, float64
threshold (float, optional) – The threshold value of Relu6. Default is 6.0.
name (str, optional) – The default value is None. Normally there is no need for user to set this property. For more information, please refer to Name.
Output of relu6 operator, a Tensor with the same shape as input
- Return type
import paddle.fluid as fluid import numpy as np in1 = np.array([[-1,0],[2.5,7.8]]) with fluid.dygraph.guard(): x1 = fluid.dygraph.to_variable(in1) out1 = fluid.layers.relu6(x=x1, threshold=6.0) print(out1.numpy()) # [[0. 0. ] # [2.5 6. ]]