pub enum Error {
Show 42 variants
UnexpectedDType {
msg: &'static str,
expected: DType,
got: DType,
},
DTypeMismatchBinaryOp {
lhs: DType,
rhs: DType,
op: &'static str,
},
UnsupportedDTypeForOp(DType, &'static str),
DimOutOfRange {
shape: Shape,
dim: i32,
op: &'static str,
},
DuplicateDimIndex {
shape: Shape,
dims: Vec<usize>,
op: &'static str,
},
UnexpectedNumberOfDims {
expected: usize,
got: usize,
shape: Shape,
},
UnexpectedShape {
msg: String,
expected: Shape,
got: Shape,
},
ShapeMismatch {
buffer_size: usize,
shape: Shape,
},
ShapeMismatchBinaryOp {
lhs: Shape,
rhs: Shape,
op: &'static str,
},
ShapeMismatchCat {
dim: usize,
first_shape: Shape,
n: usize,
nth_shape: Shape,
},
ShapeMismatchSplit {
shape: Shape,
dim: usize,
n_parts: usize,
},
OnlySingleDimension {
op: &'static str,
dims: Vec<usize>,
},
EmptyTensor {
op: &'static str,
},
DeviceMismatchBinaryOp {
lhs: DeviceLocation,
rhs: DeviceLocation,
op: &'static str,
},
NarrowInvalidArgs {
shape: Shape,
dim: usize,
start: usize,
len: usize,
msg: &'static str,
},
Conv1dInvalidArgs {
inp_shape: Shape,
k_shape: Shape,
padding: usize,
stride: usize,
msg: &'static str,
},
InvalidIndex {
op: &'static str,
index: usize,
size: usize,
},
BroadcastIncompatibleShapes {
src_shape: Shape,
dst_shape: Shape,
},
CannotSetVar {
msg: &'static str,
},
MatMulUnexpectedStriding(Box<MatMulUnexpectedStriding>),
RequiresContiguous {
op: &'static str,
},
OpRequiresAtLeastOneTensor {
op: &'static str,
},
OpRequiresAtLeastTwoTensors {
op: &'static str,
},
BackwardNotSupported {
op: &'static str,
},
NotCompiledWithCudaSupport,
NotCompiledWithMetalSupport,
CannotFindTensor {
path: String,
},
Cuda(Box<dyn Error + Send + Sync>),
Metal(MetalError),
Ug(Error),
TryFromIntError(TryFromIntError),
Npy(String),
Zip(ZipError),
ParseInt(ParseIntError),
FromUtf8(FromUtf8Error),
Io(Error),
SafeTensor(SafeTensorError),
UnsupportedSafeTensorDtype(Dtype),
Wrapped(Box<dyn Error + Send + Sync>),
WithPath {
inner: Box<Self>,
path: PathBuf,
},
WithBacktrace {
inner: Box<Self>,
backtrace: Box<Backtrace>,
},
Msg(String),
}
Expand description
Main library error type.
Variants§
UnexpectedDType
DTypeMismatchBinaryOp
UnsupportedDTypeForOp(DType, &'static str)
DimOutOfRange
DuplicateDimIndex
UnexpectedNumberOfDims
UnexpectedShape
ShapeMismatch
ShapeMismatchBinaryOp
ShapeMismatchCat
ShapeMismatchSplit
OnlySingleDimension
EmptyTensor
DeviceMismatchBinaryOp
NarrowInvalidArgs
Conv1dInvalidArgs
InvalidIndex
BroadcastIncompatibleShapes
CannotSetVar
MatMulUnexpectedStriding(Box<MatMulUnexpectedStriding>)
RequiresContiguous
OpRequiresAtLeastOneTensor
OpRequiresAtLeastTwoTensors
BackwardNotSupported
NotCompiledWithCudaSupport
NotCompiledWithMetalSupport
CannotFindTensor
Cuda(Box<dyn Error + Send + Sync>)
Metal(MetalError)
Ug(Error)
TryFromIntError(TryFromIntError)
Npy(String)
Zip(ZipError)
Zip file format error.
ParseInt(ParseIntError)
Integer parse error.
FromUtf8(FromUtf8Error)
Utf8 parse error.
Io(Error)
I/O error.
SafeTensor(SafeTensorError)
SafeTensor error.
UnsupportedSafeTensorDtype(Dtype)
Wrapped(Box<dyn Error + Send + Sync>)
Arbitrary errors wrapping.
WithPath
Adding path information to an error.
WithBacktrace
Msg(String)
User generated error message, typically created via bail!
.
Implementations§
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()
Source§impl From<FromUtf8Error> for Error
impl From<FromUtf8Error> for Error
Source§fn from(source: FromUtf8Error) -> Self
fn from(source: FromUtf8Error) -> Self
Converts to this type from the input type.
Source§impl From<MetalError> for Error
impl From<MetalError> for Error
Source§fn from(source: MetalError) -> Self
fn from(source: MetalError) -> Self
Converts to this type from the input type.
Source§impl From<ParseIntError> for Error
impl From<ParseIntError> for Error
Source§fn from(source: ParseIntError) -> Self
fn from(source: ParseIntError) -> Self
Converts to this type from the input type.
Source§impl From<SafeTensorError> for Error
impl From<SafeTensorError> for Error
Source§fn from(source: SafeTensorError) -> Self
fn from(source: SafeTensorError) -> Self
Converts to this type from the input type.
Source§impl From<TryFromIntError> for Error
impl From<TryFromIntError> for Error
Source§fn from(source: TryFromIntError) -> Self
fn from(source: TryFromIntError) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for Error
impl !RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl !UnwindSafe 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
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