paddle. stanh ( x, scale_a=0.67, scale_b=1.7159, name=None ) [source]

stanh activation.

\[out = b *\]

System Message: WARNING/2 (/usr/local/lib/python3.8/site-packages/paddle/tensor/ of paddle.tensor.math.stanh, line 6)

Block quote ends without a blank line; unexpected unindent.

rac{e^{a * x} - e^{-a * x}}{e^{a * x} + e^{-a * x}}


x (Tensor): The input Tensor with data type float32, float64. scale_a (float, optional): The scale factor a of the input. Default is 0.67. scale_b (float, optional): The scale factor b of the output. Default is 1.7159. name (str, optional): Name for the operation (optional, default is None).

System Message: ERROR/3 (/usr/local/lib/python3.8/site-packages/paddle/tensor/ of paddle.tensor.math.stanh, line 13)

Unexpected indentation.

For more information, please refer to Name.


A Tensor with the same data type and shape as x .

import paddle

x = paddle.to_tensor([1.0, 2.0, 3.0, 4.0])
out = paddle.stanh(x, scale_a=0.67, scale_b=1.72) # [1.00616539, 1.49927628, 1.65933108, 1.70390463]