Fix condition for threshold-skipping
@@ -236,15 +236,20 @@ def pass_compute_thresholds(graph: Graph) -> None:
for m in exec_list:
# find a a backward path between the quantizer and the convolution ie. a path represented by a list [Q, ..., C]
p = [m]
+ ok = True
while p[-1].op_type != 'Conv':
non_variable_input = [inode for inode in p[-1].input_nodes
- if (not cast(Operator, inode).is_variable and inode.is_monotonic)
+ if (inode.op_type != 'Constant' and inode.is_monotonic)
or inode.op_type == 'Conv']
if len(non_variable_input) != 1:
+ ok = False
break
p.append(non_variable_input[-1])
+ if len(p[-1].output_op_list) != 1:
+ ok = False
+ break
- if p[-1].op_type != 'Conv':
+ if not ok:
continue
activation_quantizer_node = p[0]
conv_node = p[-1]
