fhelium.compile.frontend._eager_capture
Capture mixed Tensor expressions and Engine calls into one Program.
Symbolic values preserve their numerical roles. Engine adapters expose actual Tensor dataflow without executing numerical kernels or generating keys.
capture_eager
function View source
def capture_eager(function: Callable[..., object], *, arguments: Mapping[str, object], workspace: CompileWorkspace | None=None, material_names: Mapping[str, object] | None=None) -> Compilation: ...Capture a Python function as mixed public Tensor and encrypted dataflow.
Runtime Tensor, ciphertext, plaintext and key arguments become SSA inputs. Python scalars are static parameters. Ordinary Tensor arithmetic remains ordinary Torch calls; encrypted numerical operators become semantic FHE operations. Supported Engine calls retain their concrete CKKS transitions and actual key/table Tensor operands. Capture does not encrypt public inputs or generate keys. Missing evaluation keys remain material placeholders.
Fixed Tensor/value references, including nested list/tuple/dict containers, become live material bindings. Their contents are not constant-folded. Numerical data is never executed during capture: ordinary Tensor metadata is propagated with FakeTensor kernels. Explicit Engine codec preparation becomes runtime operations with advancing rounding state.
The original function is retained as the source reference. Function-backed compiled helpers are source-inlined under the outer compilation choices. Static Python control flow and structured outputs are supported. Data-based Python branching, in-place operations and arbitrary callable objects require other frontend or manual Program support; no capture fallback is attempted.