softplus¶
- paddle.fluid.layers.ops. softplus ( x, beta: float = 1.0, threshold: float = 20.0, name=None ) [source]
-
- alias_main
-
paddle.nn.functional.softplus
- alias
-
paddle.nn.functional.softplus, paddle.nn.functional.activation.softplus
- old_api
-
paddle.fluid.layers.softplus
Softplus Activation Operator
- Equation:
-
\[\begin{split}out = \\frac{1}{beta} * log(1 + e^{beta * x}) For numerical stability, the implementation reverts to the linear function when: beta * x > threshold.\end{split}\]
- Parameters
-
x (Tensor) – Input of Softplus op, Tensor, dtype: float32 or float64
beta (float, optional) – The value of beta for softplus. Default is 1
threshold (float, optional) – The value of threshold for softplus. Default is 20
name (str, optional) – Name for the operation (optional, default is None)
- Returns
-
The output of Softplus op, Tensor, dtype: float32 or float64
- Return type
-
Variable
Examples
import paddle import paddle.nn.functional as F x = paddle.to_tensor([-0.4, -0.2, 0.1, 0.3]) out = F.softplus(x) print(out) # [0.513015, 0.598139, 0.744397, 0.854355]