Skip to main content

InferenceRegistry

Struct InferenceRegistry 

Source
pub struct InferenceRegistry { /* private fields */ }
Expand description

A registry mapping (domain, op_type, opset) to an InferenceFn.

Implementations§

Source§

impl InferenceRegistry

Source

pub fn infer_graph( &self, graph: &mut Graph, opset_imports: &HashMap<String, u64>, policy: MergePolicy, ) -> Result<InferenceReport, ShapeInferError>

Infer shapes for every value in graph, in topological order.

Seeds the known types (graph inputs and initializers), runs each node’s rule to fill its outputs’ types and shape-data, then writes the resolved shapes back into the graph (lowering symbolic dimension expressions to IR Dims). Graph outputs are reconciled with their declared shapes under policy. Returns an InferenceReport of what resolved.

opset_imports selects the effective operator versions; pass graph.opset_imports.clone() for the model’s own imports.

Source§

impl InferenceRegistry

Source

pub fn empty() -> Self

An empty registry (no rules).

Source

pub fn default_registry() -> Self

A registry populated with every built-in rule.

Source

pub fn register( &mut self, domain: &str, op: &str, min_opset: u64, rule: InferenceFn, )

Register rule for (domain, op) applying from opset min_opset upward. A later registration at a higher min_opset supersedes this one for those versions.

Source

pub fn get(&self, domain: &str, op: &str, version: u64) -> Option<InferenceFn>

Look up the rule for (domain, op) effective at opset version: the registration with the greatest min_opset <= version.

Source

pub fn infer_node( &self, node: &Node, opset_imports: &HashMap<String, u64>, inputs: Vec<NodeIo>, policy: MergePolicy, interner: &mut SymbolInterner, ) -> Result<Vec<NodeIo>, ShapeInferError>

Infer a single node’s outputs.

Returns one NodeIo per output slot. An unregistered op (or one whose rule declines to resolve an output) yields empty NodeIos — the permissive “leave it unknown” outcome, never an error.

Trait Implementations§

Source§

impl Default for InferenceRegistry

Source§

fn default() -> InferenceRegistry

Returns the “default value” for a type. 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> 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, 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.