Skip to content

Commit 02624c5

Browse files
committed
map qkeras quantized_bits(n, m) -> ap_fixed<n,m+1>
1 parent 33add01 commit 02624c5

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

hls4ml/converters/keras/qkeras.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def get_type(quantizer_config):
7272
else:
7373
return IntegerPrecisionType(width=width, signed=True)
7474
else:
75-
return FixedPrecisionType(width=width+1, integer=integer+1, signed=True)
75+
return FixedPrecisionType(width=width, integer=integer+1, signed=True)
7676

7777
def get_quantizer_from_config(keras_layer, quantizer_var):
7878
quantizer_config = keras_layer['config']['{}_quantizer'.format(quantizer_var)]

hls4ml/utils/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def _get_precision_from_quantizer(quantizer):
3535

3636
supported_quantizers = ['quantized_bits', 'quantized_relu', 'quantized_tanh', 'quantized_po2', 'quantized_relu_po2']
3737
if quantizer['class_name'] in supported_quantizers:
38-
bits = int(quantizer['config']['bits']) + 1
38+
bits = int(quantizer['config']['bits'])
3939
# if integer isn't specified, it should be the same as bits
4040
integer = int(quantizer['config'].get('integer', bits-1)) + 1
4141

0 commit comments

Comments
 (0)