softsign

paddle.nn.functional. softsign ( x, name=None ) [source]

softsign activation

\[softsign(x) = \frac{x}{1 + |x|}\]
Parameters
  • x (Tensor) – The input Tensor with data type float32, float64.

  • 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([-0.4, -0.2, 0.1, 0.3])
out = F.softsign(x)
print(out)
# Tensor(shape=[4], dtype=float32, place=Place(gpu:0), stop_gradient=True,
#        [-0.28571430, -0.16666666,  0.09090909,  0.23076925])