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

LogSigmoid

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

Applies the element-wise function:

LogSigmoid ( x ) = log ( 1 1 + exp ( x ) ) \text{LogSigmoid}(x) = \log\left(\frac{ 1 }{ 1 + \exp(-x)}\right)
Shape:
  • Input: ( ) (*) , where * means any number of dimensions.
  • Output: ( ) (*) , same shape as the input.
../_images/LogSigmoid.png

Examples:

>>> m = nn.LogSigmoid()
>>> 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.LogSigmoid.html