Gradient

Trait Gradient 

Source
pub trait Gradient<IN, OUT> {
    // Required method
    fn wrt(&self, variables: IN) -> OUT;
}
Expand description

Return the derivative/s with-respect-to the chosen variables. This allows you to get the gradient of a function with respect to any selection of variables, i.e. - a single variable, - a subset of the variables, - or all of the variables.

Required Methods§

Source

fn wrt(&self, variables: IN) -> OUT

Returns the derivative/s with-respect-to the chosen variables.

Implementations on Foreign Types§

Source§

impl<'v> Gradient<&Variable<'v>, f64> for Vec<f64>

wrt a single variable.

Source§

fn wrt(&self, variable: &Variable<'_>) -> f64

Source§

impl<'v> Gradient<&Vec<Variable<'v>>, Vec<f64>> for Vec<f64>

wrt a borrowed vector of variables.

Source§

fn wrt(&self, variables: &Vec<Variable<'v>>) -> Vec<f64>

Source§

impl<'v> Gradient<&[Variable<'v>], Vec<f64>> for Vec<f64>

wrt a borrowed slice of variables.

Source§

fn wrt(&self, variables: &[Variable<'v>]) -> Vec<f64>

Source§

impl<'v, const N: usize> Gradient<&[Variable<'v>; N], Vec<f64>> for Vec<f64>

wrt a borrowed array of variables.

Source§

fn wrt(&self, variables: &[Variable<'v>; N]) -> Vec<f64>

Source§

impl<'v, const N: usize> Gradient<[Variable<'v>; N], Vec<f64>> for Vec<f64>

wrt an array of variables.

Source§

fn wrt(&self, variables: [Variable<'v>; N]) -> Vec<f64>

Implementors§