pub enum Error {
Show 36 variants
UnexpectedDType {
msg: &'static str,
expected: DType,
got: DType,
},
DTypeMismatchBinaryOp {
lhs: DType,
rhs: DType,
op: &'static str,
},
DTypeMismatch {
lhs: DType,
rhs: DType,
op: &'static str,
},
UnsupportedDTypeForOp(DType, &'static str),
IndexOutOfRangeTake {
storage_len: usize,
index: usize,
},
IndexOutOfRange {
max_size: usize,
index: usize,
op: &'static str,
},
DimOutOfRange {
shape: Shape,
dim: i32,
op: &'static str,
},
DimSizeOutOfRange {
size: usize,
op: &'static str,
},
DuplicateDimIndex {
shape: Shape,
dims: Vec<usize>,
op: &'static str,
},
RepeatRankOutOfRange {
repeats: Shape,
shape: Shape,
},
ElementCountMismatchInReshape {
origin: Shape,
target: Shape,
},
ElementSizeMismatch {
expected: usize,
got: usize,
op: &'static str,
},
UnexpectedNumberOfDims {
expected: usize,
got: usize,
shape: Shape,
},
UnexpectedShape {
msg: String,
expected: Shape,
got: Shape,
},
RequiresContiguous {
op: &'static str,
},
InvalidIndex {
index: usize,
size: usize,
op: &'static str,
},
ShapeMismatchBinaryOp {
lhs: Shape,
rhs: Shape,
op: &'static str,
},
DeviceMismatchBinaryOp {
lhs: String,
rhs: String,
op: &'static str,
},
ShapeMismatchCat {
dim: usize,
first_shape: Shape,
n: usize,
nth_shape: Shape,
},
ShapeMismatchMaskedSelect {
src: Shape,
condition: Shape,
},
ShapeMismatchSelect {
mask: Shape,
who: &'static str,
},
ShapeMismatchCopyFrom {
dst: Shape,
src: Shape,
},
NarrowInvalidArgs {
shape: Shape,
dim: usize,
start: usize,
len: usize,
msg: &'static str,
},
SqueezeDimNot1 {
shape: Shape,
dim: usize,
},
BroadcastIncompatibleShapes {
src_shape: Shape,
dst_shape: Shape,
},
OpRequiresAtLeastOneTensor {
op: &'static str,
},
Rand(String),
NotScalar,
BackwardNotSupported(&'static str),
ParseInt(ParseIntError),
FromUtf8(FromUtf8Error),
Io(Error),
Utf8(Utf8Error),
MetaTensor,
Msg(String),
UnwrapNone,
}Variants§
UnexpectedDType
DTypeMismatchBinaryOp
DTypeMismatch
A Float/Int tensor holds a concrete precision (f32/f64, …) decided at
runtime; two operands must share the same precision. Use .cast(..) to align them.
UnsupportedDTypeForOp(DType, &'static str)
IndexOutOfRangeTake
IndexOutOfRange
DimOutOfRange
DimSizeOutOfRange
DuplicateDimIndex
RepeatRankOutOfRange
ElementCountMismatchInReshape
ElementSizeMismatch
UnexpectedNumberOfDims
UnexpectedShape
RequiresContiguous
InvalidIndex
ShapeMismatchBinaryOp
DeviceMismatchBinaryOp
ShapeMismatchCat
ShapeMismatchMaskedSelect
ShapeMismatchSelect
ShapeMismatchCopyFrom
NarrowInvalidArgs
SqueezeDimNot1
BroadcastIncompatibleShapes
OpRequiresAtLeastOneTensor
Rand(String)
NotScalar
BackwardNotSupported(&'static str)
ParseInt(ParseIntError)
Integer parse error.
FromUtf8(FromUtf8Error)
Utf8 parse error.
Io(Error)
I/O error.
Utf8(Utf8Error)
MetaTensor
Storage error
Msg(String)
User generated error message
UnwrapNone
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<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.
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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