Skip to content
fn

sigmoid_inplace_op

→TensorImplPtr
int sigmoid_inplace_op(const int & a)

In-place logistic sigmoid: writes σ(x)=1/(1+e−x)\sigma(x) = 1/(1 + e^{-x}) back into a.

Math

ai←σ(ai)=11+e−aia_i \leftarrow \sigma(a_i) = \frac{1}{1 + e^{-a_i}}

See Also

sigmoid_op — out-of-place counterpart.

Parameters

aTensorImplPtr
Tensor to apply sigmoid to in place. Must be non-null.

Returns

TensorImplPtr

The same pointer as a.

Notes

Primarily useful for inference paths where the pre-activation buffer can be safely reused. Avoid in training when a is saved for the backward of a downstream op.