mindspore.mint.nn.Sigmoid
- class mindspore.mint.nn.Sigmoid[source]
Apply sigmoid activation function element-wise.
Sigmoid function is defined as:
\[\text{sigmoid}(x_i) = \frac{1}{1 + \exp(-x_i)},\]where \(x_i\) is the element of x.
Sigmoid Activation Function Graph:
- Inputs:
input (Tensor) - The input tensor.
- Outputs:
Tensor.
- Supported Platforms:
Ascend
Examples
>>> import mindspore >>> input = mindspore.tensor([-1, -2, 0, 2, 1], mindspore.float16) >>> sigmoid = mindspore.mint.nn.Sigmoid() >>> output = sigmoid(input) >>> print(output) [0.2688 0.11914 0.5 0.881 0.7305 ]