Function dfdx::tensor_ops::sigmoid

source ·
pub fn sigmoid<S: Shape, E: Dtype, D: UnaryKernel<SigmoidKernelOp, E>, T: Tape<E, D>>(
    t: Tensor<S, E, D, T>
) -> Tensor<S, E, D, T>
Expand description

Sigmoid. 1 / (1 + exp(-t)).

The derivative is sigmoid(t) * (1.0 - sigmoid(t)).

Examples:

let t = dev.tensor([-1.0, 0.0, 1.0, 2.0]);
let r = t.sigmoid();