pub enum Error {
ShapeMismatch {
expected: Shape,
actual: Shape,
},
NotBroadcastable {
left: Shape,
right: Shape,
},
DTypeMismatch {
expected: DType,
actual: DType,
},
UnsupportedDType {
op: &'static str,
dtype: DType,
},
QuantizedElementAccess {
dtype: DType,
block_size: usize,
},
StorageTooSmall {
shape: Shape,
dtype: DType,
expected: usize,
actual: usize,
},
PartialQuantizedBlock {
dtype: DType,
count: usize,
block_size: usize,
},
IndexOutOfBounds {
dim: usize,
index: usize,
len: usize,
},
MalformedModel {
format: &'static str,
reason: String,
},
UnsupportedModelFeature {
format: &'static str,
feature: String,
},
MissingTensor {
name: String,
},
Io(Error),
}Expand description
Every way a Kopitiam Runtime operation can fail.
This is one shared error type across the runtime crates rather than a
per-crate error enum. Inference is a single pipeline — a shape mismatch
deep in a kernel surfaces to the caller who asked for a token — and
threading five From conversions through every layer to express that
buys nothing but ceremony.
Note what is not here: no Other(String) escape hatch. Every variant
carries the structured data needed to explain the failure, because
“InvalidModel: something went wrong” is exactly the kind of error that
costs an afternoon to debug.
Variants§
ShapeMismatch
NotBroadcastable
DTypeMismatch
UnsupportedDType
QuantizedElementAccess
StorageTooSmall
PartialQuantizedBlock
IndexOutOfBounds
MalformedModel
UnsupportedModelFeature
MissingTensor
Io(Error)
Trait Implementations§
Source§impl Error for Error
impl Error for Error
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()
Auto Trait Implementations§
impl !RefUnwindSafe for Error
impl !UnwindSafe for Error
impl Freeze for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnsafeUnpin for Error
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