Trait Value

Source
pub trait Value: ValueSpec {
    // Required methods
    fn tensors(&self) -> Self::Tensors;
    fn grad(
        tensors: &Self::Tensors,
        grad_map: &HashMap<usize, Tensor>,
    ) -> Self::Gradient;
    fn grad_map(
        tensors: &Self::Tensors,
        grad: Self::Gradient,
        out: &mut HashMap<usize, Tensor>,
    );

    // Provided method
    fn to_tensor_vec(&self) -> Vec<Tensor> { ... }
}

Required Methods§

Source

fn tensors(&self) -> Self::Tensors

Source

fn grad( tensors: &Self::Tensors, grad_map: &HashMap<usize, Tensor>, ) -> Self::Gradient

Source

fn grad_map( tensors: &Self::Tensors, grad: Self::Gradient, out: &mut HashMap<usize, Tensor>, )

Provided Methods§

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T> Value for T
where T: ValueSpec + GenericValue<T::Kind, T::Tensors, T::Gradient>,