pub enum Error {
RuntimeNotConfigured,
MissingGlobalContext {
type_name: &'static str,
},
ContextTypeMismatch {
expected: &'static str,
},
Backend(Error),
Autodiff(AutodiffError),
InvalidAdTensor {
message: String,
},
MixedReverseTape {
expected: u64,
found: u64,
},
UnsupportedRuntimeOp {
op: &'static str,
runtime: &'static str,
},
UnsupportedAdOp {
op: &'static str,
},
}Expand description
Crate-wide error type for API skeleton operations.
§Examples
use ad_tensors_rs::{Error, Result};
fn maybe_fail(flag: bool) -> Result<()> {
if flag {
Ok(())
} else {
Err(Error::InvalidAdTensor {
message: "demo".into(),
})
}
}
assert!(maybe_fail(true).is_ok());
assert!(maybe_fail(false).is_err());Variants§
RuntimeNotConfigured
The runtime used by builder .run() was not configured.
MissingGlobalContext
A required thread-local global context is missing.
ContextTypeMismatch
Stored context could not be downcast to the expected type.
Backend(Error)
Wrapper for backend/linalg/einsum errors from tenferro crates.
Autodiff(AutodiffError)
Wrapper for AD-rule level errors from chainrules-core.
InvalidAdTensor
AD tensor operands are structurally invalid for the requested operation.
MixedReverseTape
Reverse-mode operands belong to different tapes.
UnsupportedRuntimeOp
Operation is not available for the currently selected runtime.
UnsupportedAdOp
AD operation is not available for the requested mode.
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()
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
§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> Twhere
Self: Distribution<T>,
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