feat(fhe_circuit): create FHECircuit class to combine operation graph and compiler engine

This commit is contained in:
Umut
2021-10-04 12:05:20 +03:00
parent 6fc6991839
commit 003bad581a
11 changed files with 239 additions and 137 deletions

View File

@@ -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

View File

@@ -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