mirror of
https://github.com/zama-ai/concrete.git
synced 2026-01-09 12:57:55 -05:00
fix(frontend): use python-3.8 compatible syntax
This commit is contained in:
committed by
Quentin Bourgerie
parent
ddb7bbeaf4
commit
7402219247
@@ -525,13 +525,13 @@ class Circuit:
|
||||
# All Statistics
|
||||
|
||||
@property
|
||||
def statistics(self) -> Dict: # pragma: no cover
|
||||
def statistics(self) -> Dict:
|
||||
"""
|
||||
Get all statistics of the circuit.
|
||||
"""
|
||||
mod_stats = self._module.statistics
|
||||
func_stats = mod_stats.pop("functions")[self._name]
|
||||
return mod_stats | func_stats
|
||||
return {**mod_stats, **func_stats}
|
||||
|
||||
@property
|
||||
def configuration(self) -> Configuration:
|
||||
|
||||
@@ -14,6 +14,25 @@ from concrete import fhe
|
||||
from concrete.fhe import Client, ClientSpecs, EvaluationKeys, LookupTable, Server, Value
|
||||
|
||||
|
||||
def test_circuit_statistics(helpers):
|
||||
"""
|
||||
Test circuit statistics has statistics from both module and func.
|
||||
"""
|
||||
|
||||
configuration = helpers.configuration()
|
||||
|
||||
@fhe.compiler({"x": "encrypted", "y": "encrypted"})
|
||||
def f(x, y):
|
||||
return x + y
|
||||
|
||||
inputset = [(np.random.randint(0, 2**4), np.random.randint(0, 2**5)) for _ in range(100)]
|
||||
circuit = f.compile(inputset, configuration.fork(p_error=6e-5))
|
||||
|
||||
stat = circuit.statistics
|
||||
assert "p_error" in stat # from module
|
||||
assert "size_of_inputs" in stat # from circuit
|
||||
|
||||
|
||||
def test_circuit_str(helpers):
|
||||
"""
|
||||
Test `__str__` method of `Circuit` class.
|
||||
|
||||
Reference in New Issue
Block a user