diff --git a/frontends/concrete-python/concrete/fhe/compilation/configuration.py b/frontends/concrete-python/concrete/fhe/compilation/configuration.py index 4a728fa052..1f2a32d317 100644 --- a/frontends/concrete-python/concrete/fhe/compilation/configuration.py +++ b/frontends/concrete-python/concrete/fhe/compilation/configuration.py @@ -79,8 +79,8 @@ class Exactness(IntEnum): Exactness, to specify for specific operator the implementation preference (default and local). """ - EXACT = 0 - APPROXIMATE = 1 + APPROXIMATE = 0 + EXACT = 1 @dataclass diff --git a/frontends/concrete-python/concrete/fhe/extensions/round_bit_pattern.py b/frontends/concrete-python/concrete/fhe/extensions/round_bit_pattern.py index c67380831d..0bbe75f49a 100644 --- a/frontends/concrete-python/concrete/fhe/extensions/round_bit_pattern.py +++ b/frontends/concrete-python/concrete/fhe/extensions/round_bit_pattern.py @@ -242,6 +242,10 @@ def round_bit_pattern( lsbs_to_remove = lsbs_to_remove.lsbs_to_remove + if not isinstance(exactness, Exactness): + msg = "exactness should be of type fhe.Exactness" + raise TypeError(msg) + assert isinstance(lsbs_to_remove, int) def evaluator( diff --git a/frontends/concrete-python/concrete/fhe/mlir/converter.py b/frontends/concrete-python/concrete/fhe/mlir/converter.py index 533184eaeb..62ad2ac4a9 100644 --- a/frontends/concrete-python/concrete/fhe/mlir/converter.py +++ b/frontends/concrete-python/concrete/fhe/mlir/converter.py @@ -729,7 +729,7 @@ def tlu(self, ctx: Context, node: Node, preds: List[Conversion]) -> Conversion: variable_input.origin.properties["exactness"] or ctx.configuration.rounding_exactness ) - if exactness == Exactness.APPROXIMATE: + if exactness is Exactness.APPROXIMATE: # we clip values to enforce input precision exactly as queried original_bit_width = variable_input.origin.properties["original_bit_width"] lsbs_to_remove = variable_input.origin.properties["kwargs"]["lsbs_to_remove"] diff --git a/frontends/concrete-python/concrete/fhe/mlir/processors/process_rounding.py b/frontends/concrete-python/concrete/fhe/mlir/processors/process_rounding.py index 01abaaa8f5..01461e56ea 100644 --- a/frontends/concrete-python/concrete/fhe/mlir/processors/process_rounding.py +++ b/frontends/concrete-python/concrete/fhe/mlir/processors/process_rounding.py @@ -40,7 +40,7 @@ def apply(self, graph: Graph): exactness = self.rounding_exactness if original_lsbs_to_remove != 0 and final_lsbs_to_remove == 0: - if exactness != Exactness.APPROXIMATE: + if exactness is not Exactness.APPROXIMATE: self.replace_with_tlu(graph, node) continue