implement_ops¶
- guppyft.encode.implement_ops(hugr_pkg: Package, spec: ImplementOpsSpec, *, as_bytes: Literal[False] = False) Package[source]¶
- guppyft.encode.implement_ops(hugr_pkg: Package, spec: ImplementOpsSpec, *, as_bytes: Literal[True]) bytes
Enriches the given package using the given spec by replacing all operations in the program with function calls to the functions in spec.ops.
- Parameters:
hugr_pkg – A package containing a single module.
spec – The spec for the encoding. See EnrichmentSpec for details.
as_bytes – Whether to return bytes instead of the Package, skipping the final deserialization.
- Returns:
The enriched function as an executable HUGR package.