-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(compiler): Allow uncompressed ciphertext in compressed gate to fi…
…x composition + compression
- Loading branch information
1 parent
226ee27
commit db2c755
Showing
2 changed files
with
79 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
frontends/concrete-python/tests/execution/test_composition_compression.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
""" | ||
Tests composition + compression | ||
""" | ||
|
||
import numpy as np | ||
|
||
from concrete import fhe | ||
|
||
|
||
def test_composable_with_input_compression(helpers): | ||
""" | ||
Test that the composable circuit and compression works together | ||
""" | ||
|
||
conf = helpers.configuration() | ||
if conf.parameter_selection_strategy != fhe.ParameterSelectionStrategy.MULTI: | ||
# Composability is for now only valid with multi | ||
return | ||
|
||
@fhe.compiler({"x": "encrypted"}) | ||
def f(x): | ||
return (x**2) % 2**3 | ||
|
||
conf.composable = True | ||
conf.compress_input_ciphertexts = True | ||
circuit = f.compile(fhe.inputset(fhe.uint3), conf) | ||
result = circuit.run(circuit.run(circuit.encrypt(2))) | ||
assert circuit.decrypt(result) == f(f(2)) |