pub struct VitPatchConfig {
pub image_size: usize,
pub patch_size: usize,
pub n_channels: usize,
pub d_model: usize,
}Expand description
Configuration for VitPatchEmbed.
The image is [n_channels × image_size × image_size]. It is tiled into
(image_size / patch_size)² non-overlapping patches, each flattened to
patch_size² · n_channels values and projected to d_model.
Fields§
§image_size: usizeSquare image spatial size (height = width).
patch_size: usizeSquare patch spatial size (stride = patch_size).
n_channels: usizeNumber of input channels (e.g. 3 for RGB).
d_model: usizeOutput token embedding dimension.
Implementations§
Source§impl VitPatchConfig
impl VitPatchConfig
Sourcepub fn validate(&self) -> VisionResult<()>
pub fn validate(&self) -> VisionResult<()>
Validate the configuration.
§Errors
VisionError::InvalidPatchSizeifpatch_size == 0orimage_sizeis not an exact multiple ofpatch_size.VisionError::InvalidEmbedDimifd_model == 0.VisionError::InvalidImageSizeifimage_size == 0orn_channels == 0.
Trait Implementations§
Source§impl Clone for VitPatchConfig
impl Clone for VitPatchConfig
Source§fn clone(&self) -> VitPatchConfig
fn clone(&self) -> VitPatchConfig
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 VitPatchConfig
impl Debug for VitPatchConfig
impl Eq for VitPatchConfig
Source§impl PartialEq for VitPatchConfig
impl PartialEq for VitPatchConfig
Source§fn eq(&self, other: &VitPatchConfig) -> bool
fn eq(&self, other: &VitPatchConfig) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for VitPatchConfig
Auto Trait Implementations§
impl Freeze for VitPatchConfig
impl RefUnwindSafe for VitPatchConfig
impl Send for VitPatchConfig
impl Sync for VitPatchConfig
impl Unpin for VitPatchConfig
impl UnsafeUnpin for VitPatchConfig
impl UnwindSafe for VitPatchConfig
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