pub struct Embedding { /* private fields */ }Implementations§
Source§impl Embedding
impl Embedding
pub fn new( num_embeddings: u32, embedding_dim: u32, padding_idx: Option<u32>, max_norm: Option<impl Into<Scalar>>, norm_type: impl Into<Scalar>, dtype: DType, ) -> Result<Embedding, HoduError>
pub fn from_pretrained( weight: Tensor, freeze: bool, ) -> Result<Embedding, HoduError>
pub fn forward(&self, input: &Tensor) -> Result<Tensor, HoduError>
pub fn parameters(&mut self) -> Vec<&mut Tensor>
pub fn weight(&self) -> &Tensor
pub fn num_embeddings(&self) -> u32
pub fn embedding_dim(&self) -> u32
pub fn padding_idx(&self) -> Option<u32>
pub fn max_norm(&self) -> Option<f32>
pub fn norm_type(&self) -> f32
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Embedding
impl RefUnwindSafe for Embedding
impl Send for Embedding
impl Sync for Embedding
impl Unpin for Embedding
impl UnsafeUnpin for Embedding
impl UnwindSafe for Embedding
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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