-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(frontend-python): Enable multi output programs
- Loading branch information
1 parent
09af803
commit d224f3e
Showing
3 changed files
with
47 additions
and
70 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
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
47 changes: 47 additions & 0 deletions
47
frontends/concrete-python/tests/execution/test_multi_output.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,47 @@ | ||
""" | ||
Tests of execution with multiple outputs. | ||
""" | ||
|
||
import pytest | ||
|
||
from concrete import fhe | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"function,parameters", | ||
[ | ||
pytest.param( | ||
lambda x: (x * 2, x - 2), | ||
{ | ||
"x": {"range": [0, 10], "status": "encrypted"}, | ||
}, | ||
), | ||
pytest.param( | ||
lambda x, y: (x * 2, y - 2), | ||
{ | ||
"x": {"range": [0, 2], "status": "encrypted"}, | ||
"y": {"range": [0, 15], "status": "encrypted"}, | ||
}, | ||
), | ||
pytest.param( | ||
lambda x, y: (x * 2, y - 2), | ||
{ | ||
"x": {"range": [0, 2], "shape": (2, 3), "status": "encrypted"}, | ||
"y": {"range": [0, 15], "status": "encrypted"}, | ||
}, | ||
), | ||
], | ||
) | ||
def test_multi_output(function, parameters, helpers): | ||
""" | ||
Test functions with multiple outputs. | ||
""" | ||
|
||
parameter_encryption_statuses = helpers.generate_encryption_statuses(parameters) | ||
configuration = helpers.configuration() | ||
compiler = fhe.Compiler(function, parameter_encryption_statuses) | ||
inputset = helpers.generate_inputset(parameters) | ||
circuit = compiler.compile(inputset, configuration) | ||
|
||
sample = helpers.generate_sample(parameters) | ||
helpers.check_execution(circuit, function, sample) |