Skip to main content

tensorlogic_infer/
error.rs

1//! Error types for execution engines.
2
3use thiserror::Error;
4
5#[derive(Error, Debug)]
6pub enum ExecutorError {
7    #[error("Tensor '{0}' not found")]
8    TensorNotFound(String),
9
10    #[error("Invalid einsum spec: {0}")]
11    InvalidEinsumSpec(String),
12
13    #[error("Shape mismatch: {0}")]
14    ShapeMismatch(String),
15
16    #[error("Unsupported operation: {0}")]
17    UnsupportedOperation(String),
18
19    #[error("Invalid axis: {axis} for tensor with rank {rank}")]
20    InvalidAxis { axis: usize, rank: usize },
21
22    #[error("Graph validation failed: {0}")]
23    GraphValidationError(String),
24
25    #[error("Node {0} has invalid dependencies")]
26    InvalidDependencies(usize),
27
28    #[error("Profiling error: {0}")]
29    ProfilingError(String),
30
31    #[error("Batch execution error: {0}")]
32    BatchExecutionError(String),
33
34    #[error("Memory allocation failed: {0}")]
35    MemoryError(String),
36
37    #[error("Device error: {0}")]
38    DeviceError(String),
39
40    #[error("Type error: expected {expected}, got {actual}")]
41    TypeError { expected: String, actual: String },
42
43    #[error("Dimension mismatch: {0}")]
44    DimensionMismatch(String),
45
46    #[error("Empty input: {0}")]
47    EmptyInput(String),
48
49    #[error("Backend capability not supported: {0}")]
50    CapabilityNotSupported(String),
51
52    #[error("Invalid input: {0}")]
53    InvalidInput(String),
54}