fn
sigmoid
→Tensorsigmoid(x: Tensor)Logistic sigmoid activation.
Squashes any real-valued input into the open interval . Historically the canonical activation for binary classification heads and the gating function in LSTM / GRU cells.
Parameters
xTensorInput tensor of any shape; activation is element-wise.
Returns
TensorActivated tensor with the same shape as x, values in
.
Notes
Derivative .
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 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.5000, 0.8808])