Skip to main content

ExecutionError

Enum ExecutionError 

Source
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.

Fields

§node: NodeId

The input node that was not bound at execution time.

§

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.

Fields

§node: NodeId

The node that was incorrectly bound.

§op: OpKind

The operation kind of node.

§

InvalidBindingNode

A binding was provided for a node that does not exist in the graph.

This typically indicates that:

  • a stale NodeId was reused, or
  • a NodeId from another graph was supplied.

Fields

§node: NodeId

The invalid node identifier supplied in the bindings.

§

DuplicateBinding

Multiple bindings were provided for the same input node.

Input bindings must be unique by NodeId.

Fields

§node: NodeId

The input node that was bound more than once.

§

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

§node: NodeId

The input node whose binding had the wrong shape.

§expected: Vec<usize>

The shape declared by the graph for node.

§actual: Vec<usize>

The shape of the tensor supplied by the caller.

§

KernelNotFound

No kernel implementation was registered for the requested operation.

This prevents execution of any node with the given OpKind.

Fields

§op: OpKind

The operation kind for which no kernel was registered.

§

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

§node: NodeId

The graph node whose kernel execution failed.

§op: OpKind

The operation kind being executed at node.

§source: KernelError

The 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

Source§

fn clone(&self) -> ExecutionError

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ExecutionError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for ExecutionError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.