mirror of
https://github.com/zama-ai/concrete.git
synced 2026-02-09 03:55:04 -05:00
feat(fhe_circuit): create FHECircuit class to combine operation graph and compiler engine
This commit is contained in:
@@ -22,13 +22,13 @@ x = hnp.EncryptedScalar(hnp.UnsignedInteger(2))
|
||||
y = hnp.EncryptedScalar(hnp.UnsignedInteger(1))
|
||||
|
||||
# Compile the function to its homomorphic equivalent
|
||||
engine = hnp.compile_numpy_function(
|
||||
circuit = hnp.compile_numpy_function(
|
||||
f, {"x": x, "y": y},
|
||||
[(0, 0), (0, 1), (1, 0), (1, 1), (2, 0), (2, 1), (3, 0), (3, 1)],
|
||||
)
|
||||
|
||||
# Make homomorphic inference
|
||||
engine.run(1, 0)
|
||||
circuit.run(1, 0)
|
||||
```
|
||||
|
||||
## Overview
|
||||
|
||||
@@ -12,6 +12,10 @@ In this section we will go over some terms that we use throughout the project.
|
||||
- bounds
|
||||
- before intermediate representation is sent to the compiler, we need to know which node will output which type (e.g., uint3 vs uint5)
|
||||
- there are several ways to do this but the simplest one is to evaluate the intermediate representation with all combinations of inputs and remember the maximum and the minimum values for each node, which is what we call bounds, and bounds can be used to determine the appropriate type for each node
|
||||
- fhe circuit
|
||||
- it is the result of compilation
|
||||
- it contains the operation graph and the compiler engine in it
|
||||
- it has methods for printing, visualizing, and evaluating
|
||||
|
||||
## Module structure
|
||||
|
||||
|
||||
Reference in New Issue
Block a user