#[derive(SimpleForwardDiffable)]Expand description
implement a default ForwardDiffable with trait bounds as the following:
impl<S, SelfInput, SelfOutput, SelfGradient> autodiff::autodiffable::ForwardDiffable<S> for T
where
Self: autodiff::autodiffable::AutoDiffable<S, Input = SelfInput, Output = SelfOutput>,
SelfInput: autodiff::gradienttype::GradientType<SelfOutput, GradientType = SelfGradient>,
SelfGradient: autodiff::forward::ForwardMul<SelfInput, SelfInput, ResultGrad = SelfOutput>,
{
//type Input = SelfInput;
//type Output = SelfOutput;
fn eval_forward_grad(
&self,
x: &Self::Input,
dx: &Self::Input,
s: &S,
) -> (Self::Output, Self::Output) {
let (f, df) = self.eval_grad(x, s);
(f, df.forward_mul(dx))
}
}This will only work if:
- the struct is
AutoDiffable - the input type is
GradientType<OutputType> - the output type is
ForwardMul<InputType, InputType, ResultGrad = OutputType>