diff --git a/b_asic/operation.py b/b_asic/operation.py index acbd7bd0245e056bb19d6110b7def77235105052..557210bae107fcd5c59e3ae5e28c8ab5e7058fb9 100644 --- a/b_asic/operation.py +++ b/b_asic/operation.py @@ -928,14 +928,13 @@ class AbstractOperation(Operation, AbstractGraphComponent): ) return self.input(0) - # TODO: Fix def quantize_input(self, index: int, value: Num, bits: int) -> Num: if isinstance(value, (float, int)): - return round(value) & ((2**bits) - 1) + b = 2**bits + return round((value + 1) * b % (2 * b) - b) / b else: raise TypeError - # TODO: Seems wrong??? - Oscar def quantize_inputs( self, input_values: Sequence[Num],