Differentiable

Trait Differentiable 

Source
pub trait Differentiable: Clone {
    type Primal: Clone;

    // Required method
    fn ad_value(&self) -> &AdValue<Self::Primal>;
}
Expand description

A value that can be observed as an AdValue.

§Examples

use ad_tensors_rs::{AdMode, AdValue, Differentiable};

fn mode_of<V: Differentiable>(value: &V) -> AdMode {
    value.ad_value().mode()
}

let x = AdValue::primal(2.0_f64);
assert_eq!(mode_of(&x), AdMode::Primal);

Required Associated Types§

Source

type Primal: Clone

Underlying primal payload type.

Required Methods§

Source

fn ad_value(&self) -> &AdValue<Self::Primal>

Borrow as an AdValue.

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: Clone + Scalar> Differentiable for AdTensor<T>

Source§

type Primal = Tensor<T>

Source§

impl<T: Clone> Differentiable for AdValue<T>

Source§

impl<T: Clone> Differentiable for AdScalar<T>