Sigmoid

Contents

Sigmoid#

class brainstate.nn.Sigmoid(name=None)#

Applies the element-wise function.

Sigmoid is defined as:

\[\text{Sigmoid}(x) = \sigma(x) = \frac{1}{1 + \exp(-x)}\]

Shape#

  • Input: \((*)\), where \(*\) means any number of dimensions.

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

Examples

>>> import brainstate.nn as nn
>>> import brainstate
>>> m = nn.Sigmoid()
>>> x = brainstate.random.randn(2)
>>> output = m(x)