pytorch / 2 / generated / torch.nn.softsign.html

Softsign

class torch.nn.Softsign(*args, **kwargs) [source]

Applies the element-wise function:

SoftSign ( x ) = x 1 + x \text{SoftSign}(x) = \frac{x}{ 1 + |x|}
Shape:
  • Input: ( ) (*) , where * means any number of dimensions.
  • Output: ( ) (*) , same shape as the input.
../_images/Softsign.png

Examples:

>>> m = nn.Softsign()
>>> input = torch.randn(2)
>>> output = m(input)

© 2024, PyTorch Contributors
PyTorch has a BSD-style license, as found in the LICENSE file.
https://pytorch.org/docs/2.1/generated/torch.nn.Softsign.html