pub struct InferenceRegistry { /* private fields */ }Expand description
A registry mapping (domain, op_type, opset) to an InferenceFn.
Implementations§
Source§impl InferenceRegistry
impl InferenceRegistry
Sourcepub fn infer_graph(
&self,
graph: &mut Graph,
opset_imports: &HashMap<String, u64>,
policy: MergePolicy,
) -> Result<InferenceReport, ShapeInferError>
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 every explicitly known value type, runs each node’s rule to fill or
refine 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
impl InferenceRegistry
Sourcepub fn default_registry() -> Self
pub fn default_registry() -> Self
A registry populated with every built-in rule.
Sourcepub fn register(
&mut self,
domain: &str,
op: &str,
min_opset: u64,
rule: InferenceFn,
)
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.
Sourcepub fn get(&self, domain: &str, op: &str, version: u64) -> Option<InferenceFn>
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.