mirror of
https://github.com/zama-ai/concrete.git
synced 2026-02-08 19:44:57 -05:00
docs: simplify explicit api example in readme
This commit is contained in:
18
README.md
18
README.md
@@ -66,23 +66,19 @@ if you have a function object that you cannot decorate, you can use the explicit
|
||||
```python
|
||||
import concrete.numpy as cnp
|
||||
|
||||
def adder(constant):
|
||||
def add(x):
|
||||
return x + constant
|
||||
return add
|
||||
def add(x, y):
|
||||
return x + y
|
||||
|
||||
add_42 = adder(42)
|
||||
|
||||
compiler = cnp.Compiler(add_42, {"x": "encrypted"})
|
||||
inputset = range(10)
|
||||
compiler = cnp.Compiler(add, {"x": "encrypted", "y": "encrypted"})
|
||||
inputset = [(2, 3), (0, 0), (1, 6), (7, 7), (7, 1), (3, 2), (6, 1), (1, 7), (4, 5), (5, 4)]
|
||||
|
||||
print(f"Compiling...")
|
||||
circuit = compiler.compile(inputset)
|
||||
|
||||
examples = [4, 2, 5, 9, 0]
|
||||
examples = [(3, 4), (1, 2), (7, 7), (0, 0)]
|
||||
for example in examples:
|
||||
result = circuit.encrypt_run_decrypt(example)
|
||||
print(f"Evaluation of {example} + 42 homomorphically = {result}")
|
||||
result = circuit.encrypt_run_decrypt(*example)
|
||||
print(f"Evaluation of {' + '.join(map(str, example))} homomorphically = {result}")
|
||||
```
|
||||
|
||||
# For developers
|
||||
|
||||
Reference in New Issue
Block a user