ml_switcheroo.compiler¶
Compiler Package.
This package defines the core Intermediate Representation (IR) and Backend interfaces for the ml-switcheroo compilation pipeline. It separates the logical definition of a computation graph from the frontend parsing and backend generation logic.
Submodules¶
Classes¶
Abstract base class for compilation backends. |
|
Language-agnostic representation of the neural network structure. |
|
Represents a computation unit (Layer) in the graph. |
|
Represents data flow between two nodes. |
Package Contents¶
- class ml_switcheroo.compiler.CompilerBackend[source]¶
Bases:
abc.ABCAbstract base class for compilation backends.
- abstractmethod compile(graph: ml_switcheroo.compiler.ir.LogicalGraph) Any[source]¶
Compiles the Logical Intermediate Representation (IR) into a target artifact.
- Parameters:
graph (LogicalGraph) – The intermediate representation of the model structure.
- Returns:
The compiled output (e.g., source code string, binary buffer, or AST).
- Return type:
Any
- class ml_switcheroo.compiler.LogicalGraph[source]¶
Language-agnostic representation of the neural network structure.
- name: str = 'Model'¶
Name of the graph model/class.
- nodes: List[LogicalNode] = []¶
Ordered list of nodes in the graph.
- edges: List[LogicalEdge] = []¶
List of directed edges between nodes.
- class ml_switcheroo.compiler.LogicalNode[source]¶
Represents a computation unit (Layer) in the graph.
- id: str¶
Unique identifier (e.g. ‘conv1’).
- kind: str¶
Operation type (e.g. ‘Conv2d’, ‘Input’, ‘Output’).
- metadata: Dict[str, str]¶
Dictionary of configuration parameters (e.g.
kernel_size=3).