oneflow.nn.Sigmoid

class oneflow.nn.Sigmoid

Applies the element-wise function:

\[\text{Sigmoid}(x) = \sigma(x) = \frac{1}{1 + \exp(-x)}\]
Shape:
  • Input: \((N, *)\) where * means, any number of additional dimensions

  • Output: \((N, *)\), same shape as the input

For example:

>>> import numpy as np
>>> import oneflow as flow

>>> x = flow.Tensor(np.array([0.81733328, 0.43621480, 0.10351428]))
>>> m = flow.nn.Sigmoid()
>>> out = m(x)
>>> out
tensor([0.6937, 0.6074, 0.5259], dtype=oneflow.float32)