pub enum MatrixTensorConversionError {
Rank {
shape: Vec<usize>,
},
HostBuffer {
message: String,
},
}Expand description
Error returned when converting a [TypedTensor] into a Matrix.
Use this when accepting dynamic tensor-shaped values at a dense-matrix boundary. It reports whether conversion failed because the tensor was not a rank-2 matrix or because its host buffer could not be consumed.
§Examples
use tenferro::TypedTensor;
use tensor4all_tensorbackend::Matrix;
let tensor = TypedTensor::from_vec_col_major(vec![2, 1, 1], vec![1.0_f64, 2.0])?;
let err = Matrix::try_from_typed_tensor(tensor).unwrap_err();
assert!(err.to_string().contains("rank-2 tensor"));Variants§
Rank
The input tensor rank was not two.
HostBuffer
The tensor did not contain an owned host buffer that can be consumed.
Trait Implementations§
Source§impl Debug for MatrixTensorConversionError
impl Debug for MatrixTensorConversionError
Source§impl Error for MatrixTensorConversionError
impl Error for MatrixTensorConversionError
1.30.0 · 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 Freeze for MatrixTensorConversionError
impl RefUnwindSafe for MatrixTensorConversionError
impl Send for MatrixTensorConversionError
impl Sync for MatrixTensorConversionError
impl Unpin for MatrixTensorConversionError
impl UnsafeUnpin for MatrixTensorConversionError
impl UnwindSafe for MatrixTensorConversionError
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
impl<T, U> Imply<T> for U
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