pub enum ExecutionError {
MissingInput {
node: NodeId,
},
BindingToNonInputNode {
node: NodeId,
op: OpKind,
},
InvalidBindingNode {
node: NodeId,
},
DuplicateBinding {
node: NodeId,
},
InputShapeMismatch {
node: NodeId,
expected: Vec<usize>,
actual: Vec<usize>,
},
KernelNotFound {
op: OpKind,
},
KernelExecutionFailed {
node: NodeId,
op: OpKind,
source: KernelError,
},
GraphError(GraphError),
InternalError(&'static str),
}Expand description
Errors that may occur while validating bindings or executing a graph.
These errors distinguish between:
- invalid caller-supplied bindings,
- graph-level failures,
- missing kernel implementations, and
- runtime kernel failures.
§Examples
let mut g = Graph::new();
let x = g.input_node(vec![2, 2]);
g.set_output_node(x).expect("Valid output node should succeed");
let wrong = Tensor::zeros(vec![3, 3]).expect("Tensor allocation should succeed");
let exec = Executor::new(KernelRegistry::default());
let err = exec.execute(&g, vec![(x, wrong)]).unwrap_err();
assert!(matches!(err, ExecutionError::InputShapeMismatch { .. }));Variants§
MissingInput
A required input node was not provided in the bindings.
Every OpKind::Input node in the graph must have exactly one runtime binding.
BindingToNonInputNode
A binding was provided for a node that exists in the graph but is not an input node.
Only input nodes may be bound directly by the caller.
InvalidBindingNode
A binding was provided for a node that does not exist in the graph.
This typically indicates that:
DuplicateBinding
Multiple bindings were provided for the same input node.
Input bindings must be unique by NodeId.
InputShapeMismatch
A runtime tensor shape did not match the graph input node’s declared shape.
The expected shape is taken from the graph node, while actual is the
shape of the caller-provided tensor.
Fields
KernelNotFound
No kernel implementation was registered for the requested operation.
This prevents execution of any node with the given OpKind.
KernelExecutionFailed
A kernel returned an error while executing a specific graph node.
This variant preserves:
- the failing node ID,
- the operation kind being executed, and
- the underlying
KernelError.
Fields
source: KernelErrorThe underlying kernel error returned by the registered kernel.
GraphError(GraphError)
A graph-level failure occurred while preparing execution.
This wraps errors originating from graph traversal or graph validation, such as cycle detection or invalid node references.
InternalError(&'static str)
An internal executor invariant was violated.
This variant indicates a bug or malformed internal state rather than a user-facing validation issue. Under normal operation, callers should not be able to trigger this error through the public API alone.
Trait Implementations§
Source§impl Clone for ExecutionError
impl Clone for ExecutionError
Source§fn clone(&self) -> ExecutionError
fn clone(&self) -> ExecutionError
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more