Skip to main content

canonicalize_graph

Function canonicalize_graph 

Source
pub fn canonicalize_graph(graph: &EinsumGraph) -> Result<EinsumGraph, IrError>
Expand description

Canonicalize a computation graph.

This function converts a graph into a canonical form where:

  • Tensors are renamed to t0, t1, t2, … in topological order
  • Nodes are sorted in execution order
  • Inputs and outputs are sorted consistently

The resulting graph is semantically equivalent to the original but has a normalized structure that facilitates comparison and hashing.