Skip to content

Commit

Permalink
map qkeras quantized_bits(n, m) -> ap_fixed<n,m+1>
Browse files Browse the repository at this point in the history
  • Loading branch information
jmduarte committed May 14, 2021
1 parent 33add01 commit 02624c5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion hls4ml/converters/keras/qkeras.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def get_type(quantizer_config):
else:
return IntegerPrecisionType(width=width, signed=True)
else:
return FixedPrecisionType(width=width+1, integer=integer+1, signed=True)
return FixedPrecisionType(width=width, integer=integer+1, signed=True)

def get_quantizer_from_config(keras_layer, quantizer_var):
quantizer_config = keras_layer['config']['{}_quantizer'.format(quantizer_var)]
Expand Down
2 changes: 1 addition & 1 deletion hls4ml/utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def _get_precision_from_quantizer(quantizer):

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

Expand Down

0 comments on commit 02624c5

Please sign in to comment.