Skip to content

Commit 915d2e1

Browse files
committed
better handle cases when there is no previous node
1 parent 76d06e7 commit 915d2e1

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

hls4ml/model/optimizer/passes/batchnorm_opt.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ class FuseConsecutiveBatchNormalization(OptimizerPass):
166166
"""
167167

168168
def match(self, node):
169-
prev_node = node.get_input_node(node.inputs[0])
169+
prev_node = node.get_input_node()
170170
basic_match = (
171171
isinstance(node, BatchNormalization)
172172
and isinstance(prev_node, BatchNormalization)
@@ -194,7 +194,7 @@ def match(self, node):
194194
return False
195195

196196
def transform(self, model, node):
197-
prev_node = node.get_input_node(node.inputs[0])
197+
prev_node = node.get_input_node()
198198

199199
prev_map = prev_node.get_output_use_map()
200200
if len(prev_map[prev_node.outputs[0]]) > 1:

hls4ml/model/optimizer/passes/bn_fuse.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class FuseBatchNormalization(OptimizerPass):
1818
"""
1919

2020
def match(self, node):
21-
prev_node = node.get_input_node(node.inputs[0])
21+
prev_node = node.get_input_node()
2222
basic_match = (
2323
isinstance(node, BatchNormalization)
2424
and isinstance(prev_node, (Dense, Conv1D, Conv2D))

0 commit comments

Comments
 (0)