pub struct LearnedPositionalEmbedding {
pub max_positions: usize,
pub embed_dim: usize,
pub weight: WeightTensor,
}Expand description
Learned positional embedding table (GPT-2 style).
Weight shape: [max_positions × embed_dim].
Fields§
§max_positions: usizeMaximum number of positions.
embed_dim: usizeEmbedding dimension.
weight: WeightTensorWeight table.
Implementations§
Source§impl LearnedPositionalEmbedding
impl LearnedPositionalEmbedding
Sourcepub fn new(max_positions: usize, embed_dim: usize) -> LmResult<Self>
pub fn new(max_positions: usize, embed_dim: usize) -> LmResult<Self>
Construct with zero-initialised weights.
Sourcepub fn from_weight(weight: WeightTensor) -> LmResult<Self>
pub fn from_weight(weight: WeightTensor) -> LmResult<Self>
Construct from an existing weight tensor.
Trait Implementations§
Source§impl Clone for LearnedPositionalEmbedding
impl Clone for LearnedPositionalEmbedding
Source§fn clone(&self) -> LearnedPositionalEmbedding
fn clone(&self) -> LearnedPositionalEmbedding
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for LearnedPositionalEmbedding
impl RefUnwindSafe for LearnedPositionalEmbedding
impl Send for LearnedPositionalEmbedding
impl Sync for LearnedPositionalEmbedding
impl Unpin for LearnedPositionalEmbedding
impl UnsafeUnpin for LearnedPositionalEmbedding
impl UnwindSafe for LearnedPositionalEmbedding
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