Skip to content
fn

sigmoid

→Tensor
sigmoid(input: Tensor)

Implementing kernel

C++ engine symbols that back this Python API.

Logistic sigmoid activation.

Squashes any real-valued input into the open interval (0,1)(0, 1). Historically the canonical activation for binary classification heads and the gating function in LSTM / GRU cells.

Parameters

inputTensor
Input tensor of any shape; activation is element-wise.

Returns

Tensor

Activated tensor with the same shape as input, values in (0,1)(0, 1).

Notes

σ(x)=11+e−x\sigma(x) = \frac{1}{1 + e^{-x}}

Derivative σ′(x)=σ(x)(1−σ(x))≤0.25\sigma'(x) = \sigma(x)(1 - \sigma(x)) \le 0.25. The bounded derivative is the classical cause of the vanishing gradient problem in deep feed-forward stacks, so for hidden layers prefer ReLU / GELU / SiLU. For binary classification logits, use logsigmoid to compute log⁡σ(x)\log\sigma(x) in a numerically stable way.

Examples

>>> import lucid
>>> from lucid.nn.functional import sigmoid
>>> x = lucid.tensor([-2.0, 0.0, 2.0])
>>> sigmoid(x)
tensor([0.1192, 0.5, 0.8808])

Used by 4