pub enum ModelError {
Show 17 variants
InvalidConfig {
message: String,
},
DimensionMismatch {
context: String,
expected: usize,
got: usize,
},
NotInitialized {
details: String,
},
WeightLoadError {
tensor_name: String,
reason: String,
},
TensorNotFound {
name: String,
model: String,
},
LoadError {
context: String,
message: String,
},
ForwardError {
layer_idx: usize,
message: String,
},
StateCountMismatch {
model: String,
expected: usize,
got: usize,
},
InvalidBatchSize {
expected: usize,
got: usize,
},
NumericalInstability {
operation: String,
details: String,
},
UnsupportedOperation {
operation: String,
model_type: String,
},
QuantizationError {
message: String,
},
AllocationError {
bytes: usize,
purpose: String,
},
IndexOutOfBounds {
index: usize,
limit: usize,
context: String,
},
CoreError(CoreError),
CandleError(Error),
IoError(Error),
}Expand description
Errors that can occur in model operations
Variants§
InvalidConfig
DimensionMismatch
NotInitialized
WeightLoadError
TensorNotFound
LoadError
ForwardError
StateCountMismatch
InvalidBatchSize
NumericalInstability
UnsupportedOperation
QuantizationError
AllocationError
IndexOutOfBounds
CoreError(CoreError)
CandleError(Error)
IoError(Error)
Implementations§
Source§impl ModelError
impl ModelError
Sourcepub fn invalid_config(message: impl Into<String>) -> Self
pub fn invalid_config(message: impl Into<String>) -> Self
Create an invalid config error (backward compatible)
Sourcepub fn dimension_mismatch(
context: impl Into<String>,
expected: usize,
got: usize,
) -> Self
pub fn dimension_mismatch( context: impl Into<String>, expected: usize, got: usize, ) -> Self
Create a dimension mismatch error with context
Sourcepub fn not_initialized(details: impl Into<String>) -> Self
pub fn not_initialized(details: impl Into<String>) -> Self
Create a not initialized error (backward compatible)
Sourcepub fn load_error(
context: impl Into<String>,
message: impl Into<String>,
) -> Self
pub fn load_error( context: impl Into<String>, message: impl Into<String>, ) -> Self
Create a load error (backward compatible)
Sourcepub fn simple_load_error(message: impl Into<String>) -> Self
pub fn simple_load_error(message: impl Into<String>) -> Self
Create a simple load error (backward compatible)
Sourcepub fn forward_error(layer_idx: usize, message: impl Into<String>) -> Self
pub fn forward_error(layer_idx: usize, message: impl Into<String>) -> Self
Create a forward error with layer index
Sourcepub fn weight_load_error(
tensor_name: impl Into<String>,
reason: impl Into<String>,
) -> Self
pub fn weight_load_error( tensor_name: impl Into<String>, reason: impl Into<String>, ) -> Self
Create a weight loading error
Sourcepub fn tensor_not_found(
name: impl Into<String>,
model: impl Into<String>,
) -> Self
pub fn tensor_not_found( name: impl Into<String>, model: impl Into<String>, ) -> Self
Create a tensor not found error
Sourcepub fn state_count_mismatch(
model: impl Into<String>,
expected: usize,
got: usize,
) -> Self
pub fn state_count_mismatch( model: impl Into<String>, expected: usize, got: usize, ) -> Self
Create a state count mismatch error
Sourcepub fn numerical_instability(
operation: impl Into<String>,
details: impl Into<String>,
) -> Self
pub fn numerical_instability( operation: impl Into<String>, details: impl Into<String>, ) -> Self
Create a numerical instability error
Sourcepub fn unsupported_operation(
operation: impl Into<String>,
model_type: impl Into<String>,
) -> Self
pub fn unsupported_operation( operation: impl Into<String>, model_type: impl Into<String>, ) -> Self
Create an unsupported operation error
Sourcepub fn quantization_error(message: impl Into<String>) -> Self
pub fn quantization_error(message: impl Into<String>) -> Self
Create a quantization error
Trait Implementations§
Source§impl Debug for ModelError
impl Debug for ModelError
Source§impl Display for ModelError
impl Display for ModelError
Source§impl Error for ModelError
impl Error for ModelError
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<CoreError> for ModelError
impl From<CoreError> for ModelError
Source§impl From<Error> for ModelError
impl From<Error> for ModelError
Auto Trait Implementations§
impl Freeze for ModelError
impl !RefUnwindSafe for ModelError
impl Send for ModelError
impl Sync for ModelError
impl Unpin for ModelError
impl !UnwindSafe for ModelError
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.