pub struct Ia3Layer { /* private fields */ }Expand description
IA³ layer implementing learned rescaling vectors.
For non-feedforward modules: output = base_output * ia3_vector
For feedforward modules: output = base_layer(input * ia3_vector)
Implementations§
Source§impl Ia3Layer
impl Ia3Layer
Sourcepub fn new(
in_features: usize,
out_features: usize,
is_feedforward: bool,
config: Ia3Config,
device: &Device,
) -> Result<Ia3Layer, PeftError>
pub fn new( in_features: usize, out_features: usize, is_feedforward: bool, config: Ia3Config, device: &Device, ) -> Result<Ia3Layer, PeftError>
Create a new IA³ layer.
§Arguments
in_features- Input dimensionout_features- Output dimensionis_feedforward- Whether this is a feedforward layer (scales input vs output)config- IA³ configurationdevice- Device to create tensors on
§Errors
Returns error if configuration is invalid or tensor initialization fails.
Sourcepub fn scaling_vector(&self) -> &Tensor
pub fn scaling_vector(&self) -> &Tensor
Get the scaling vector.
Sourcepub fn is_feedforward(&self) -> bool
pub fn is_feedforward(&self) -> bool
Check if this is a feedforward layer.
Trait Implementations§
Source§impl Adapter for Ia3Layer
impl Adapter for Ia3Layer
Auto Trait Implementations§
impl Freeze for Ia3Layer
impl !RefUnwindSafe for Ia3Layer
impl Send for Ia3Layer
impl Sync for Ia3Layer
impl Unpin for Ia3Layer
impl !UnwindSafe for Ia3Layer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more