Skip to main content

Reparameterization

Trait Reparameterization 

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

    // Required method
    fn apply<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§

const NAME: &'static str

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

Required Methods§

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

Apply the transformation to the stored base, returning the effective parameter value.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

§

impl Reparameterization for LoraAdapter

§

const NAME: &'static str = "lora"