Skip to content

Commit 62046d7

Browse files
bo3zvloncar
authored andcommitted
QConv alpha='auto' bugfix
1 parent c5507f3 commit 62046d7

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

hls4ml/model/optimizer/passes/qkeras.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,11 +189,18 @@ def transform(self, model, node):
189189
else:
190190
scale_quantizer = None
191191

192+
if 'Dense' in node.class_name:
193+
n_in = node.get_attr('n_out')
194+
elif 'Conv' in node.class_name:
195+
n_in = node.get_attr('out_width') * node.get_attr('out_height', 1) * node.get_attr('n_filt')
196+
else:
197+
n_in = node.get_attr('n_out')
198+
192199
attrs = {
193200
'name' : node.get_attr('name') + '_alpha',
194201
'class_name' : 'Alpha',
195202
'inputs' : node.outputs,
196-
'n_in' : node.get_attr('n_out'),
203+
'n_in' : n_in,
197204
'n_filt' : node.get_attr('n_filt', -1),
198205
'reuse_factor' : node.get_attr('reuse_factor'),
199206
'scale_data': scale,

0 commit comments

Comments
 (0)