Softplus

class paddle.nn.Softplus ( beta\=1, threshold\=20, name\=None ) [源代码]

Softplus激活层

Softplus - 图1

其中,xx 为输入的 Tensor

参数

  • beta (float, 可选) - Softplus激活计算公式中的beta值。默认值为1。

  • threshold (float, 可选) - Softplus激活计算公式中的threshold值。默认值为20。

  • name (str, 可选) - 操作的名称(可选,默认值为None)。更多信息请参见 Name

形状:

  • input: 任意形状的Tensor。

  • output: 和input具有相同形状的Tensor。

代码示例

  1. import paddle
  2. import numpy as np
  3. x = paddle.to_tensor(np.array([-0.4, -0.2, 0.1, 0.3]))
  4. m = paddle.nn.Softplus()
  5. out = m(x) # [0.513015, 0.598139, 0.744397, 0.854355]