pub enum SparseAttentionError {
InvalidWindowSize(usize),
InvalidSequenceLength(usize),
InvalidGlobalIndices {
index: usize,
seq_len: usize,
},
DimensionMismatch {
context: String,
expected: usize,
got: usize,
},
NumericalInstability {
position: usize,
},
}Expand description
Errors raised during sparse attention mask generation or forward pass.
Variants§
InvalidWindowSize(usize)
Window size must be strictly positive.
InvalidSequenceLength(usize)
Sequence length must be strictly positive.
InvalidGlobalIndices
One or more global token indices exceed the sequence length.
DimensionMismatch
Query, key, or value tensors have incompatible shapes.
NumericalInstability
A softmax row collapsed to zero mass after masking.
Trait Implementations§
Source§impl Clone for SparseAttentionError
impl Clone for SparseAttentionError
Source§fn clone(&self) -> SparseAttentionError
fn clone(&self) -> SparseAttentionError
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SparseAttentionError
impl Debug for SparseAttentionError
Source§impl Display for SparseAttentionError
impl Display for SparseAttentionError
Source§impl Error for SparseAttentionError
impl Error for SparseAttentionError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Source§impl From<SparseAttentionError> for TrustformerError
impl From<SparseAttentionError> for TrustformerError
Source§fn from(err: SparseAttentionError) -> Self
fn from(err: SparseAttentionError) -> Self
Converts to this type from the input type.
Source§impl PartialEq for SparseAttentionError
impl PartialEq for SparseAttentionError
impl StructuralPartialEq for SparseAttentionError
Auto Trait Implementations§
impl Freeze for SparseAttentionError
impl RefUnwindSafe for SparseAttentionError
impl Send for SparseAttentionError
impl Sync for SparseAttentionError
impl Unpin for SparseAttentionError
impl UnsafeUnpin for SparseAttentionError
impl UnwindSafe for SparseAttentionError
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,
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