Trait Gradient

Source
pub trait Gradient<T, S> {
    // Required method
    fn wrt(&self, v: T) -> S;
}
Expand description

Calculate gradients with respect to particular variables.

Required Methods§

Source

fn wrt(&self, v: T) -> S

Calculate the gradient with respect to variable(s) v.

Implementations on Foreign Types§

Source§

impl<'a> Gradient<&Vec<Var<'a>>, Vec<f64>> for Vec<f64>

Calculate the gradient with respect to all variables in v. Returns a vector, where the items in the vector are the gradients with respect to the variable in the original list v, in the same order.

Source§

fn wrt(&self, v: &Vec<Var<'a>>) -> Vec<f64>

Source§

impl<'a> Gradient<&Var<'a>, f64> for Vec<f64>

Calculate the gradient with respect to variable v.

Source§

fn wrt(&self, v: &Var<'_>) -> f64

Source§

impl<'a> Gradient<&[Var<'a>], Vec<f64>> for Vec<f64>

Calculate the gradient with respect to all variables in v. Returns a vector, where the items in the vector are the gradients with respect to the variable in the original list v, in the same order.

Source§

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

Source§

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

Calculate the gradient with respect to all variables in v. Returns a vector, where the items in the vector are the gradients with respect to the variable in the original list v, in the same order.

Source§

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

Source§

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

Calculate the gradient with respect to all variables in v. Returns a vector, where the items in the vector are the gradients with respect to the variable in the original list v, in the same order.

Source§

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

Implementors§