INNER CODE UNIT · Python

_run

lean-dojo/TorchLean · torchlean/__init__.py:48

def _run(command: list[str], arguments: Sequence[str], *, report: bool = False
         ) -> subprocess.CompletedProcess[str]:
    result = subprocess.run(command + list(arguments), capture_output=True, text=True, check=False)
    if result.returncode not in ((0, 1) if report else (0,)):
        raise RuntimeError(f"TorchLean checker exited with {result.returncode}: {result.stderr.strip()}")
    return result


def _capture(model: Any, examples: tuple[Any, ...], frontend: str, command: list[str],
             directory: Path, checks: Sequence[str]) -> dict[str, Any]:
    compare = "compare" in checks or "compare_bitwise" in checks
    execute = compare or "execute" in checks
    if not examples or examples[0] is None:
        raise ValueError("capturing a computation requires example tensors")
    if frontend == "jax":
        from NN.Runtime.JAX.jaxpr import Unsupported, encode, export, references

        try:

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…