pub struct TwoWayTransformer { /* private fields */ }Expand description
Stacks several TwoWayAttentionBlocks, followed by a final token→image
attention as in SAM’s TwoWayTransformer.
Implementations§
Source§impl TwoWayTransformer
impl TwoWayTransformer
Sourcepub fn forward(
&self,
image: &[f32],
image_pe: &[f32],
point_tokens: &[f32],
) -> VisionResult<(Vec<f32>, Vec<f32>)>
pub fn forward( &self, image: &[f32], image_pe: &[f32], point_tokens: &[f32], ) -> VisionResult<(Vec<f32>, Vec<f32>)>
Run the transformer. image/image_pe are [n_i · e], point_tokens
is [n_t · e]. The point tokens double as the query positional encoding,
exactly as in SAM.
Returns (tokens [n_t · e], image [n_i · e]).
§Errors
Propagates block / attention errors.
Auto Trait Implementations§
impl Freeze for TwoWayTransformer
impl RefUnwindSafe for TwoWayTransformer
impl Send for TwoWayTransformer
impl Sync for TwoWayTransformer
impl Unpin for TwoWayTransformer
impl UnsafeUnpin for TwoWayTransformer
impl UnwindSafe for TwoWayTransformer
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