Enum ClassToken
pub enum ClassToken {
Start,
Middle,
End,
Custom(usize),
}Expand description
Position marker for a learnable class token inserted into a network’s input sequence (embedding width = the network input width / “d_input”).
Variants§
Start
Prepend before the whole sequence (index 0).
Middle
Insert before the middle token of the original sequence (index L/2).
Needs a [ClassCursors::full_len] hint.
End
Close the sequence: appended after its last token (index L) — the
only marker that trails one instead of preceding it, and so the token a
closing step returns. Needs a [ClassCursors::full_len] hint.
Custom(usize)
Insert before the original sequence’s token index — for any index,
so one at or past the end never lands (no such token), unless the caller
feeds tokens past the announced length and it precedes the next one.
Trait Implementations§
§impl ClassMarker for ClassToken
impl ClassMarker for ClassToken
§fn insert_pos(&self, orig_len: usize) -> usize
fn insert_pos(&self, orig_len: usize) -> usize
Insertion index measured against the original sequence length
orig_len.§fn group_rank(&self) -> usize
fn group_rank(&self) -> usize
Tie-break rank among markers sharing an index (
Start<Middle<End<Custom).§fn needs_full_len(&self) -> bool
fn needs_full_len(&self) -> bool
Whether this marker’s position is only defined against the whole sequence
(
Middle/End), so placing it requires a [ClassCursor::full_len] hint.§fn closes_sequence(&self) -> bool
fn closes_sequence(&self) -> bool
Whether this marker closes the sequence — trailing its last token
rather than preceding one.
End alone does.§impl Clone for ClassToken
impl Clone for ClassToken
§fn clone(&self) -> ClassToken
fn clone(&self) -> ClassToken
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 more§impl Config for ClassToken
impl Config for ClassToken
§impl Debug for ClassToken
impl Debug for ClassToken
§impl<'de> Deserialize<'de> for ClassToken
impl<'de> Deserialize<'de> for ClassToken
§fn deserialize<D>(
deserializer: D,
) -> Result<ClassToken, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<ClassToken, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
§impl Display for ClassToken
impl Display for ClassToken
§impl Serialize for ClassToken
impl Serialize for ClassToken
§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for ClassToken
impl RefUnwindSafe for ClassToken
impl Send for ClassToken
impl Sync for ClassToken
impl Unpin for ClassToken
impl UnsafeUnpin for ClassToken
impl UnwindSafe for ClassToken
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