pub struct PatchEmbedConfig {
pub img_size: usize,
pub patch_size: usize,
pub in_chans: usize,
pub embed_dim: usize,
}Expand description
Configuration for the patch embedder.
The image is assumed to have shape [in_chans, img_size, img_size].
It is split into (img_size / patch_size)² non-overlapping patches,
each of size in_chans × patch_size × patch_size, which are projected
linearly to embed_dim.
Fields§
§img_size: usizeSquare image spatial dimension (H = W).
patch_size: usizePatch spatial dimension (P × P windows, stride = P).
in_chans: usizeNumber of input channels (e.g., 3 for RGB).
embed_dim: usizeOutput token embedding dimension.
Implementations§
Source§impl PatchEmbedConfig
impl PatchEmbedConfig
Sourcepub fn new(
img_size: usize,
patch_size: usize,
in_chans: usize,
embed_dim: usize,
) -> VisionResult<Self>
pub fn new( img_size: usize, patch_size: usize, in_chans: usize, embed_dim: usize, ) -> VisionResult<Self>
Create and validate a PatchEmbedConfig.
Sourcepub fn kernel_vol(&self) -> usize
pub fn kernel_vol(&self) -> usize
Kernel volume for one filter: in_chans × patch_size².
Trait Implementations§
Source§impl Clone for PatchEmbedConfig
impl Clone for PatchEmbedConfig
Source§fn clone(&self) -> PatchEmbedConfig
fn clone(&self) -> PatchEmbedConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PatchEmbedConfig
impl Debug for PatchEmbedConfig
Source§impl PartialEq for PatchEmbedConfig
impl PartialEq for PatchEmbedConfig
Source§fn eq(&self, other: &PatchEmbedConfig) -> bool
fn eq(&self, other: &PatchEmbedConfig) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for PatchEmbedConfig
Auto Trait Implementations§
impl Freeze for PatchEmbedConfig
impl RefUnwindSafe for PatchEmbedConfig
impl Send for PatchEmbedConfig
impl Sync for PatchEmbedConfig
impl Unpin for PatchEmbedConfig
impl UnsafeUnpin for PatchEmbedConfig
impl UnwindSafe for PatchEmbedConfig
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