pub struct ViTEncoder {
pub blocks: Vec<ViTBlock>,
pub final_ln_weight: Vec<f32>,
pub final_ln_bias: Vec<f32>,
}Expand description
Encoder stack: depth ViT blocks + a final layer norm.
Fields§
§blocks: Vec<ViTBlock>The individual transformer blocks.
final_ln_weight: Vec<f32>Final LayerNorm scale: [embed_dim].
final_ln_bias: Vec<f32>Final LayerNorm bias: [embed_dim].
Implementations§
Source§impl ViTEncoder
impl ViTEncoder
Sourcepub fn new(cfg: ViTEncoderConfig, rng: &mut LcgRng) -> VisionResult<Self>
pub fn new(cfg: ViTEncoderConfig, rng: &mut LcgRng) -> VisionResult<Self>
Construct the encoder: depth blocks with independent weight
initialisations from the shared rng.
The final layer-norm is initialised with weight=1, bias=0.
Auto Trait Implementations§
impl Freeze for ViTEncoder
impl RefUnwindSafe for ViTEncoder
impl Send for ViTEncoder
impl Sync for ViTEncoder
impl Unpin for ViTEncoder
impl UnsafeUnpin for ViTEncoder
impl UnwindSafe for ViTEncoder
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