pub struct ErrorContext {
pub input_shapes: Vec<Vec<usize>>,
pub input_devices: Vec<Device>,
pub input_dtypes: Vec<DType>,
pub output_shape: Option<Vec<usize>>,
pub thread_id: String,
pub stack_trace: Option<String>,
pub metadata: HashMap<String, String>,
}Expand description
Additional context information for errors
Fields§
§input_shapes: Vec<Vec<usize>>Input tensor shapes
input_devices: Vec<Device>Input tensor devices
input_dtypes: Vec<DType>Input tensor data types
output_shape: Option<Vec<usize>>Output shape (if applicable)
thread_id: StringThread ID where error occurred
stack_trace: Option<String>Stack trace (if available)
metadata: HashMap<String, String>Additional metadata
Implementations§
Source§impl ErrorContext
impl ErrorContext
Sourcepub fn with_input_tensor(
self,
shape: &[usize],
device: Device,
dtype: DType,
) -> Self
pub fn with_input_tensor( self, shape: &[usize], device: Device, dtype: DType, ) -> Self
Add input tensor information
Sourcepub fn with_output_shape(self, shape: &[usize]) -> Self
pub fn with_output_shape(self, shape: &[usize]) -> Self
Add output shape information
Sourcepub fn with_metadata(self, key: String, value: String) -> Self
pub fn with_metadata(self, key: String, value: String) -> Self
Add metadata
Trait Implementations§
Source§impl Clone for ErrorContext
impl Clone for ErrorContext
Source§fn clone(&self) -> ErrorContext
fn clone(&self) -> ErrorContext
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ErrorContext
impl Debug for ErrorContext
Auto Trait Implementations§
impl Freeze for ErrorContext
impl RefUnwindSafe for ErrorContext
impl Send for ErrorContext
impl Sync for ErrorContext
impl Unpin for ErrorContext
impl UnsafeUnpin for ErrorContext
impl UnwindSafe for ErrorContext
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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