pub struct PatchEmbedWeights {
pub kernel: Vec<f32>,
pub bias: Vec<f32>,
pub cls_token: Vec<f32>,
}Expand description
Learnable weights for the patch embedder.
kernel has layout [embed_dim, in_chans, patch_size, patch_size]
(row-major, C-contiguous): filter e occupies
kernel[e * kernel_vol .. (e+1) * kernel_vol].
Fields§
§kernel: Vec<f32>Conv2D kernel: flat [embed_dim × in_chans × P × P].
bias: Vec<f32>Bias: flat [embed_dim].
cls_token: Vec<f32>CLS token: flat [embed_dim].
Implementations§
Source§impl PatchEmbedWeights
impl PatchEmbedWeights
Sourcepub fn default_init(cfg: &PatchEmbedConfig, rng: &mut LcgRng) -> Self
pub fn default_init(cfg: &PatchEmbedConfig, rng: &mut LcgRng) -> Self
Xavier/He-style default init: N(0, 1/√(kernel_vol)).
Auto Trait Implementations§
impl Freeze for PatchEmbedWeights
impl RefUnwindSafe for PatchEmbedWeights
impl Send for PatchEmbedWeights
impl Sync for PatchEmbedWeights
impl Unpin for PatchEmbedWeights
impl UnsafeUnpin for PatchEmbedWeights
impl UnwindSafe for PatchEmbedWeights
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