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, ) -> HoduResult<Self>
pub fn from_pretrained(weight: Tensor, freeze: bool) -> HoduResult<Self>
pub fn forward(&self, input: &Tensor) -> HoduResult<Tensor>
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