thresholded_relu¶
- paddle.nn.functional. thresholded_relu ( x, threshold=1.0, name=None ) [source]
-
thresholded relu activation.
\[\begin{split}thresholded\_relu(x) = \left\{ \begin{array}{rl} x,& \text{if } \ x > threshold \\ 0,& \text{otherwise} \end{array} \right.\end{split}\]- Parameters
-
x (Tensor) – The input Tensor with data type float32, float64.
threshold (float, optional) – The value of threshold for thresholded_relu. Default is 1.0
name (str, optional) – For details, please refer to Name. Generally, no setting is required. Default: None.
- Returns
-
A Tensor with the same data type and shape as
x
.
Examples
>>> import paddle >>> import paddle.nn.functional as F >>> x = paddle.to_tensor([2., 0., 1.]) >>> out = F.thresholded_relu(x) >>> print(out) Tensor(shape=[3], dtype=float32, place=Place(cpu), stop_gradient=True, [2., 0., 0.])