INNER CODE UNIT · Python

artifact

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

            artifact = export(model, *examples)
        except Unsupported as error:
            raise NotImplementedError(str(error)) from error
        if execute:
            artifact["arguments"] = [encode(value) for value in examples]
        if compare:
            artifact.update(references(model, *examples))
        return artifact
    if frontend != "pytorch":
        raise ValueError(f"unknown frontend {frontend!r}; use pytorch, jax, or pass an artifact")
    import torch

    if not all(isinstance(value, torch.Tensor) for value in examples):
        raise NotImplementedError("PyTorch capture requires positional tensor arguments")

    path = directory / "capture.py"
    _run(command, ["--export-pytorch", str(path)])
    spec = importlib.util.spec_from_file_location("torchlean_capture", path)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…