Sigmoid¶
- class Sigmoid(name=None)[源代码]¶
对每个元素应用函数:
\[\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.
- 返回
module. The instance of the
Sigmoid
module.- 返回类型
Return type
实际案例
>>> 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]