Skip to main content

Reparameterizer

Trait Reparameterizer 

Source
pub trait Reparameterizer {
    type Reparam: Reparameterization;

    // Required method
    fn reparameterize<const D: usize>(
        &mut self,
        path: &str,
        param: Param<Tensor<D>>,
    ) -> (Param<Tensor<D>>, Option<Self::Reparam>);
}
Expand description

Defines how floating-point parameters are prepared for reparameterization.

Module::apply_reparameterization passes every floating-point parameter encountered during module traversal to reparameterize. Implementations may use the parameter path to decide whether to attach a Reparameterization and may transform the parameter into the structural base that should be stored.

Required Associated Types§

Source

type Reparam: Reparameterization

Reparameterization produced for a parameter.

Required Methods§

Source

fn reparameterize<const D: usize>( &mut self, path: &str, param: Param<Tensor<D>>, ) -> (Param<Tensor<D>>, Option<Self::Reparam>)

Prepare a parameter and optionally create a reparameterization for it.

The returned parameter is always used as the structural base. Returning None leaves that base without a reparameterization.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§