pub struct CLIP { /* private fields */ }Expand description
CLIP Model
Implementations§
Source§impl CLIP
impl CLIP
Sourcepub fn new(config: CLIPConfig) -> Self
pub fn new(config: CLIPConfig) -> Self
Create new CLIP model
Sourcepub fn forward(
&self,
images: &Tensor,
input_ids: &Tensor,
) -> Result<Tensor, String>
pub fn forward( &self, images: &Tensor, input_ids: &Tensor, ) -> Result<Tensor, String>
Forward pass (compute similarity matrix)
Sourcepub fn zero_shot_classify(
&self,
images: &Tensor,
text_prompts: &Tensor,
) -> Result<Vec<usize>, String>
pub fn zero_shot_classify( &self, images: &Tensor, text_prompts: &Tensor, ) -> Result<Vec<usize>, String>
Zero-shot classification
Auto Trait Implementations§
impl Freeze for CLIP
impl !RefUnwindSafe for CLIP
impl Send for CLIP
impl Sync for CLIP
impl Unpin for CLIP
impl !UnwindSafe for CLIP
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
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