pub struct PromptEncoderWeights {Show 16 fields
pub pe_gaussian: Vec<f32>,
pub not_a_point_embed: Vec<f32>,
pub point_embeddings: Vec<f32>,
pub mask_conv1_w: Vec<f32>,
pub mask_conv1_b: Vec<f32>,
pub mask_ln1_g: Vec<f32>,
pub mask_ln1_b: Vec<f32>,
pub mask_conv2_w: Vec<f32>,
pub mask_conv2_b: Vec<f32>,
pub mask_ln2_g: Vec<f32>,
pub mask_ln2_b: Vec<f32>,
pub mask_conv3_w: Vec<f32>,
pub mask_conv3_b: Vec<f32>,
pub no_mask_embed: Vec<f32>,
pub embed_dim: usize,
pub mask_in_chans: usize,
}Expand description
All weights consumed by [PromptEncoder::forward]. Loaded once
from the safetensors file and then reused per prompt.
Fields§
§pe_gaussian: Vec<f32>[2, embed_dim/2] Gaussian random projection used by the
Fourier positional encoder.
not_a_point_embed: Vec<f32>[embed_dim] learned token for “not a point” padding label
(used when there are points but no boxes — labels of -1).
point_embeddings: Vec<f32>[4, embed_dim] learned per-label embeddings:
0 → background point, 1 → foreground point,
2 → box top-left corner, 3 → box bottom-right corner.
mask_conv1_w: Vec<f32>Mask downscaling stack (Conv2d → LN2d → GELU → Conv2d → LN2d → GELU → Conv2d).
mask_conv1_b: Vec<f32>§mask_ln1_g: Vec<f32>§mask_ln1_b: Vec<f32>§mask_conv2_w: Vec<f32>§mask_conv2_b: Vec<f32>§mask_ln2_g: Vec<f32>§mask_ln2_b: Vec<f32>§mask_conv3_w: Vec<f32>§mask_conv3_b: Vec<f32>§no_mask_embed: Vec<f32>[embed_dim] learned token broadcast over the image grid when
no mask prompt is supplied.
embed_dim: usize§mask_in_chans: usizemask_in_chans from candle’s Sam::new (= 16 for ViT-B).
Auto Trait Implementations§
impl Freeze for PromptEncoderWeights
impl RefUnwindSafe for PromptEncoderWeights
impl Send for PromptEncoderWeights
impl Sync for PromptEncoderWeights
impl Unpin for PromptEncoderWeights
impl UnsafeUnpin for PromptEncoderWeights
impl UnwindSafe for PromptEncoderWeights
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more