dfdx 0.13.0

Ergonomic auto differentiation in Rust, with pytorch like apis.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use crate::tensor_ops::cpu_kernels::UnaryDerivative;

impl<F: num_traits::Float> UnaryDerivative<F> for super::SigmoidKernelOp {
    const DF_USES_FX: bool = true;
    const HAS_CONST_DF: bool = false;
    #[inline(always)]
    fn f(&self, x: &F) -> F {
        F::one() / (F::one() + x.neg().exp())
    }
    #[inline(always)]
    fn df(&self, &fx: &F) -> F {
        fx * (F::one() - fx)
    }
}