Trait dfdx::tensor::Tape

source ·
pub trait Tape<E: Unit, D: DeviceStorage>: Default + Merge<Self> + Merge<NoneTape> {
    const OWNS_TAPE: bool;

    // Required methods
    fn add_backward_op<F>(&mut self, operation: F)
       where F: 'static + FnOnce(&mut Gradients<E, D>) -> Result<(), D::Err>;
    fn try_alloc_grad<S: Shape>(
        &mut self,
        t: &Tensor<S, E, D>
    ) -> Result<(), D::Err>;
}
Expand description

Something that can track backward operations.

Required Associated Constants§

source

const OWNS_TAPE: bool

Whether this object is currently tracking gradients. This is known at compile time.

Required Methods§

source

fn add_backward_op<F>(&mut self, operation: F)where F: 'static + FnOnce(&mut Gradients<E, D>) -> Result<(), D::Err>,

source

fn try_alloc_grad<S: Shape>( &mut self, t: &Tensor<S, E, D> ) -> Result<(), D::Err>

Implementors§

source§

impl<E: Unit, D: DeviceStorage> Tape<E, D> for NoneTape

source§

const OWNS_TAPE: bool = false

source§

impl<E: Unit, D: DeviceStorage> Tape<E, D> for OwnedTape<E, D>

source§

const OWNS_TAPE: bool = true