thresholded_relu

paddle.nn.functional. thresholded_relu ( x, threshold=1.0, name=None ) [source]

thresholded relu activation.

\[\begin{split}thresholded\\_relu(x) = \\begin{cases} x, \\text{if } x > threshold \\\\ 0, \\text{otherwise} \\end{cases}\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) – 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
import paddle.nn.functional as F
import numpy as np

x = paddle.to_tensor(np.array([2., 0., 1.]))
out = F.thresholded_relu(x) # [2., 0., 0.]