pub enum MnnError {
Show 22 variants
Io(Error),
InvalidModel(String),
SessionError(String),
TensorError(String),
BackendError(String),
OutOfMemory(String),
Unsupported(String),
InvalidInput(String),
InvalidPath,
Internal(String),
NullByte(NulError),
PathError {
path: PathBuf,
source: Error,
},
ShapeMismatch {
expected: Vec<i32>,
actual: Vec<i32>,
},
TypeMismatch {
expected: String,
actual: String,
},
InvalidDimension {
message: String,
},
EmptyData,
IndexOutOfBounds {
dim: usize,
index: i32,
size: i32,
},
BackendNotAvailable {
backend: String,
},
ModelNotFound(PathBuf),
SessionNotInitialized,
InterpreterNotInitialized,
FeatureNotEnabled {
feature: &'static str,
},
}Expand description
Main error type for MNN operations.
Variants§
Io(Error)
I/O error (file not found, permission denied, etc.)
InvalidModel(String)
Invalid model file or corrupted model
SessionError(String)
Failed to create or use session
TensorError(String)
Tensor operation failed
BackendError(String)
Backend not available or misconfigured
OutOfMemory(String)
Out of memory
Unsupported(String)
Operation not supported
InvalidInput(String)
Invalid input provided
InvalidPath
Invalid path (non-UTF8 or invalid format)
Internal(String)
Internal MNN error
NullByte(NulError)
Null byte in string
PathError
Path-related error
ShapeMismatch
Shape mismatch
TypeMismatch
Type mismatch
InvalidDimension
Invalid dimension
EmptyData
Empty data
IndexOutOfBounds
Index out of bounds
BackendNotAvailable
Backend not available
ModelNotFound(PathBuf)
Model file not found
SessionNotInitialized
Session not initialized
InterpreterNotInitialized
Interpreter not initialized
FeatureNotEnabled
Feature not enabled
Implementations§
Source§impl MnnError
impl MnnError
Sourcepub fn invalid_model<S: Into<String>>(msg: S) -> Self
pub fn invalid_model<S: Into<String>>(msg: S) -> Self
Create an invalid model error with context
Sourcepub fn session_error<S: Into<String>>(msg: S) -> Self
pub fn session_error<S: Into<String>>(msg: S) -> Self
Create a session error with context
Sourcepub fn tensor_error<S: Into<String>>(msg: S) -> Self
pub fn tensor_error<S: Into<String>>(msg: S) -> Self
Create a tensor error with context
Sourcepub fn backend_error<S: Into<String>>(msg: S) -> Self
pub fn backend_error<S: Into<String>>(msg: S) -> Self
Create a backend error with context
Sourcepub fn unsupported<S: Into<String>>(msg: S) -> Self
pub fn unsupported<S: Into<String>>(msg: S) -> Self
Create an unsupported error
Sourcepub fn invalid_input<S: Into<String>>(msg: S) -> Self
pub fn invalid_input<S: Into<String>>(msg: S) -> Self
Create an invalid input error
Sourcepub fn shape_mismatch(expected: &[i32], actual: &[i32]) -> Self
pub fn shape_mismatch(expected: &[i32], actual: &[i32]) -> Self
Create a shape mismatch error
Sourcepub fn out_of_memory<S: Into<String>>(msg: S) -> Self
pub fn out_of_memory<S: Into<String>>(msg: S) -> Self
Create an out of memory error
Sourcepub fn index_out_of_bounds(dim: usize, index: i32, size: i32) -> Self
pub fn index_out_of_bounds(dim: usize, index: i32, size: i32) -> Self
Create an index out of bounds error
Sourcepub fn backend_not_available<S: Into<String>>(backend: S) -> Self
pub fn backend_not_available<S: Into<String>>(backend: S) -> Self
Create a backend not available error
Sourcepub fn is_model_error(&self) -> bool
pub fn is_model_error(&self) -> bool
Check if this is a model error
Sourcepub fn is_backend_error(&self) -> bool
pub fn is_backend_error(&self) -> bool
Check if this is a backend error
Trait Implementations§
Source§impl Error for MnnError
impl Error for MnnError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()