pub enum LayerType {
FullAttention,
SlidingAttention,
LinearAttention,
Moe,
SparseAttention,
}Expand description
Layer type in a hybrid transformer model.
Variants§
FullAttention
SlidingAttention
LinearAttention
Moe
Standalone MoE FFN layer (Nemotron-H: no mixer, just expert routing + FFN).
SparseAttention
Sparse attention over a per-query selected subset of the KV cache
(deepseek_sparse_attention): a full-rank mixer whose visible key set is
chosen at runtime by an indexer, not fixed by a window.
Distinct from Self::FullAttention on purpose. Both attend over the whole
cache in principle, but a sparse layer additionally needs indexer state, an
indexer weight family, and a per-query top-k selection step — so scheduling,
cache sizing and weight binding all have to be able to tell them apart. GLM-5.3
was previously flattened onto FullAttention at parse time, which round-tripped
deepseek_sparse_attention into a lie.
Implementations§
Trait Implementations§
Source§impl<'de> Deserialize<'de> for LayerType
impl<'de> Deserialize<'de> for LayerType
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Copy for LayerType
impl Eq for LayerType
impl StructuralPartialEq for LayerType
Auto Trait Implementations§
impl Freeze for LayerType
impl RefUnwindSafe for LayerType
impl Send for LayerType
impl Sync for LayerType
impl Unpin for LayerType
impl UnwindSafe for LayerType
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,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.