fhelium.compile.frontend._capture
PyTorch FX capture into a neutral mixed-dialect IR Program.
capture
function View source
def capture(function: Callable[..., ReturnT], *, inputs: Mapping[str, InputSpec], workspace: CompileWorkspace | None=None, material_names: Mapping[str, object] | None=None) -> Compilation: ...Trace a Python callable into a neutral mixed-dialect Program.
inputs declares every parameter's encrypted, message, plaintext, or static role. Capture specializes static values, records Tensor constants as symbolic materials in Compilation.material_bindings, lowers recognized arithmetic to semantic FHElium operations, and preserves other FX calls as torch.call operations. The returned Compilation carries that Program and workspace; a CapturedCallable workspace entry retains the source callable as the pre-transform reference. Pure-public, mixed-level, and partially lowered graphs remain valid frontend results. Runtime binding and execution are not performed by this package.