Graph Execution
Core graph execution and model compilation.
-
class nabla.core.graph_execution.GraphTracer[source]
Bases: object
Handles computation graph tracing and cache key generation.
-
static compute_node_hash(node)[source]
Compute a deterministic hash for a computation node.
-
static get_trace(nodes)[source]
Perform iterative DFS to get computation trace and cache key.
- Returns:
List of leaf nodes (have impl)
trace: Topological ordering of all nodes
cache_key: Hash key for caching compiled models
- Return type:
inputs
-
class nabla.core.graph_execution.ModelFactory[source]
Bases: object
Factory for creating MAX models from computation graphs.
-
static create_model(inputs, trace, outputs, dynamic_inputs=None, show_graph=False)[source]
Create a MAX model from the computation graph.
-
nabla.core.graph_execution.realize_(outputs, dynamic_inputs=None, show_graph=False)[source]
Realize (compute) the given output Arrays.
This is the main entry point for executing computation graphs.
Uses compilation caching for performance.
- Parameters:
outputs (list[Array]) – List of Arrays to realize
dynamic_inputs (list[Array] | None) – Optional list of dynamic inputs for model compilation
return_trace_inputs – If True, return tuple of (model, trace_inputs) instead of just model
- Returns:
Model or None
If return_trace_inputs is True: tuple of (Model, trace_inputs) or None
- Return type:
If return_trace_inputs is False
-
nabla.core.graph_execution.get_trace(nodes)[source]
-
nabla.core.graph_execution.compute_node_hash(node)[source]