Skip to main content

Reparameterization

Trait Reparameterization 

Source
pub trait Reparameterization:
    AutodiffModule
    + Sync
    + 'static {
    const NAME: &'static str;

    // Required method
    fn materialize<const D: usize>(&self, base: Tensor<D>) -> Tensor<D>;
}
Expand description

A rank-specific parameter reparameterization.

Implementations are regular Modules, so their parameters automatically participate in optimizer, record, device and autodiff traversal. The implementation only needs to describe how its state materializes an effective value from the stored base parameter.

Required Associated Constants§

Source

const NAME: &'static str

Stable path component used for the reparameterization’s nested parameters.

Required Methods§

Source

fn materialize<const D: usize>(&self, base: Tensor<D>) -> Tensor<D>

Materialize the effective parameter value from its stored base.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl Reparameterization for LoraAdapter

Source§

const NAME: &'static str = "lora"