ml_switcheroo.testing.harness_generator¶

Integration Test Harness Generator.

This module creates self-contained Python scripts for verifying transpilation accuracy. It dynamically extracts source code from the live system to ensure that generated harnesses support ALL registered frameworks (Torch, JAX, Keras, etc.) without hardcoding switch statements.

Capabilities: 1. Dynamic Shim Generation: Reads convert() methods from all registered

Framework Adapters and synthesizes a standalone get_adapter function.

  1. Fuzzer Inlining: Extracts the InputFuzzer class source code.

  2. Isolation: Generated scripts run without ml_switcheroo installed.

Classes¶

HarnessGenerator

Generates standalone verification scripts.

Module Contents¶

class ml_switcheroo.testing.harness_generator.HarnessGenerator¶

Generates standalone verification scripts.

extractor¶

Tool to read source from live objects.

Type:

CodeExtractor

extractor¶
generate(source_file: pathlib.Path, target_file: pathlib.Path, output_harness: pathlib.Path, source_fw: str = 'torch', target_fw: str = 'jax', semantics: Dict[str, Any] | None = None) → None¶

Writes the standalone verification script to disk.