Sigmoid¶
- class Sigmoid(name=None)[source]¶
Applies the element-wise function:
\[\text{Sigmoid}(x) = \frac{1}{1 + \exp(-x)}\]- Shape:
``inputs``: :math:`()` where \(*\) means any member of addition dimensions. ``outpus``: :math:`()` same shape as the inputs.
- Returns
module. The instance of the
Sigmoid
module.- Return type
Return type
Examples
>>> import numpy as np >>> data = mge.tensor(np.array([-2,-1,0,1,2,]).astype(np.float32)) >>> sigmoid = M.Sigmoid() >>> output = sigmoid(data) >>> with np.printoptions(precision=6): ... print(output.numpy()) [0.119203 0.268941 0.5 0.731059 0.880797]