pub trait Gradient<R: RealScalar>: CostFunction<R> {
// Required method
fn gradient_into(&mut self, params: &[R], grad_out: RowMut<'_, R>);
// Provided methods
fn allocate_gradient(&self) -> Row<R> { ... }
fn cost_and_gradient_into(
&mut self,
params: &[R],
grad_out: RowMut<'_, R>,
) -> R { ... }
}Expand description
A trait for gradients.
Required Methods§
Sourcefn gradient_into(&mut self, params: &[R], grad_out: RowMut<'_, R>)
fn gradient_into(&mut self, params: &[R], grad_out: RowMut<'_, R>)
Calculates the gradient for the given parameters.
Provided Methods§
fn allocate_gradient(&self) -> Row<R>
Sourcefn cost_and_gradient_into(&mut self, params: &[R], grad_out: RowMut<'_, R>) -> R
fn cost_and_gradient_into(&mut self, params: &[R], grad_out: RowMut<'_, R>) -> R
Calculates the cost and gradient for the given parameters.