pub struct EmbeddingConfig {
pub num_embeddings: usize,
pub embedding_dim: usize,
pub padding_idx: Option<usize>,
pub max_norm: Option<f64>,
pub norm_type: f64,
pub scale_grad_by_freq: bool,
pub sparse: bool,
}
Expand description
Configuration for the Embedding layer
Fields§
§num_embeddings: usize
Number of embeddings in the embedding table
embedding_dim: usize
Dimension of each embedding vector
padding_idx: Option<usize>
Optional padding index that will have its embedding vector filled with zeros
max_norm: Option<f64>
Maximum norm for embedding vectors
norm_type: f64
Type of norm to use with max_norm
scale_grad_by_freq: bool
Whether to scale gradients by the inverse of frequency of the indices
sparse: bool
Whether to use sparse gradients for the embedding matrix
Trait Implementations§
Auto Trait Implementations§
impl Freeze for EmbeddingConfig
impl RefUnwindSafe for EmbeddingConfig
impl Send for EmbeddingConfig
impl Sync for EmbeddingConfig
impl Unpin for EmbeddingConfig
impl UnwindSafe for EmbeddingConfig
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