mirror of
https://github.com/zama-ai/concrete.git
synced 2026-02-09 03:55:04 -05:00
fix: allow generator inputsets again
This commit is contained in:
@@ -172,11 +172,16 @@ class Compiler:
|
||||
"""
|
||||
|
||||
if inputset is not None:
|
||||
previous_inputset_length = len(self.inputset)
|
||||
for index, sample in enumerate(iter(inputset)):
|
||||
self.inputset.append(sample)
|
||||
|
||||
if not isinstance(sample, tuple):
|
||||
sample = (sample,)
|
||||
|
||||
if len(sample) != len(self.parameter_encryption_statuses):
|
||||
self.inputset = self.inputset[:previous_inputset_length]
|
||||
|
||||
expected = (
|
||||
"a single value"
|
||||
if len(self.parameter_encryption_statuses) == 1
|
||||
@@ -191,9 +196,6 @@ class Compiler:
|
||||
f"(expected {expected} got {actual})"
|
||||
)
|
||||
|
||||
for input_ in inputset:
|
||||
self.inputset.append(input_)
|
||||
|
||||
if self.graph is None:
|
||||
try:
|
||||
first_sample = next(iter(self.inputset))
|
||||
|
||||
@@ -236,6 +236,8 @@ def test_compiler_virtual_compile(helpers):
|
||||
return x + 400
|
||||
|
||||
compiler = Compiler(f, {"x": "encrypted"})
|
||||
circuit = compiler.compile(inputset=range(400), configuration=configuration, virtual=True)
|
||||
|
||||
inputset = (i for i in range(400))
|
||||
circuit = compiler.compile(inputset, configuration=configuration, virtual=True)
|
||||
|
||||
assert circuit.encrypt_run_decrypt(200) == 600
|
||||
|
||||
Reference in New Issue
Block a user