pub struct EagerContext { /* private fields */ }Expand description
The process-wide eager execution context (docs/EAGER.md §10.1).
Manages the available EPs, the domain registry, per-op shape inference, the
compiled-kernel cache, and the default device. It is thread-safe via internal
locking so it can back the global_context singleton.
Implementations§
Source§impl EagerContext
impl EagerContext
Sourcepub fn dispatch(
&self,
op_type: &str,
domain: &str,
inputs: &[&Tensor],
attrs: &HashMap<String, Attribute>,
explicit_opset: Option<u64>,
) -> Result<Vec<Tensor>>
pub fn dispatch( &self, op_type: &str, domain: &str, inputs: &[&Tensor], attrs: &HashMap<String, Attribute>, explicit_opset: Option<u64>, ) -> Result<Vec<Tensor>>
Dispatch a single ONNX op to a kernel and return its outputs
(docs/EAGER.md §10.1). The 7-step flow, reconciled to the real APIs:
- resolve the effective opset (explicit per-call value > domain default),
- resolve the target device from the inputs (mixed devices = error),
- build the compiled-kernel cache key,
- get-or-compile the kernel via the device’s EP (missing kernel =
EagerError::NoKernel), - infer output shapes/dtypes for the single op,
- allocate the output tensors on the device,
- build zero-copy views and execute.
Source§impl EagerContext
impl EagerContext
Sourcepub fn new() -> Result<Self>
pub fn new() -> Result<Self>
Initialize a context with auto-detected devices (docs/EAGER.md §10.1).
Sourcepub fn default_device(&self) -> DeviceId
pub fn default_device(&self) -> DeviceId
The default device for input-less ops (docs/EAGER.md §4.3).
Sourcepub fn register_domain(&self, domain: &str, default_opset: u64)
pub fn register_domain(&self, domain: &str, default_opset: u64)
Register (or update) a custom domain’s default opset (docs/EAGER.md
§6.1 register_domain).
Sourcepub fn domains(&self) -> Vec<(String, u64)>
pub fn domains(&self) -> Vec<(String, u64)>
All registered domains and their default opsets (docs/EAGER.md §6.1
domains()).
Sourcepub fn cache_stats(&self) -> CacheStats
pub fn cache_stats(&self) -> CacheStats
Current kernel-cache statistics (entries / hits / misses).
Auto Trait Implementations§
impl !Freeze for EagerContext
impl !RefUnwindSafe for EagerContext
impl !UnwindSafe for EagerContext
impl Send for EagerContext
impl Sync for EagerContext
impl Unpin for EagerContext
impl UnsafeUnpin for EagerContext
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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>
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>
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