pub struct Linear { /* private fields */ }Expand description
Linear transformation layer (weight matrix multiplication)
Implementations§
Source§impl Linear
impl Linear
Sourcepub fn new(input_dim: usize, output_dim: usize) -> Self
pub fn new(input_dim: usize, output_dim: usize) -> Self
Create a new linear layer with Xavier/Glorot initialization. Uses a deterministic seeded RNG (faster than thread_rng on all platforms, especially ARM64) while still producing well-distributed weights.
Sourcepub fn output_dim(&self) -> usize
pub fn output_dim(&self) -> usize
Get output dimension
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Linear
impl<'de> Deserialize<'de> for Linear
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Linear
impl RefUnwindSafe for Linear
impl Send for Linear
impl Sync for Linear
impl Unpin for Linear
impl UnsafeUnpin for Linear
impl UnwindSafe for Linear
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