ml_switcheroo.compiler.backends¶

Compiler Backends Package.

Contains concrete implementations of the CompilerBackend interface for specific target languages/formats (e.g., Python, RDNA, SASS).

Submodules¶

Classes¶

PythonBackend

Synthesizes a Python CST Module from a LogicalGraph.

Package Contents¶

class ml_switcheroo.compiler.backends.PythonBackend(framework: str = 'torch', semantics: Any = None)[source]¶

Bases: ml_switcheroo.compiler.backend.CompilerBackend

Synthesizes a Python CST Module from a LogicalGraph.

framework = 'torch'¶
compile(graph: ml_switcheroo.compiler.ir.LogicalGraph) → str[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

generate(graph: ml_switcheroo.compiler.ir.LogicalGraph, class_name: str = 'SwitcherooNet', original_tree: libcst.Module | None = None) → str[source]¶