Skip to content

Commit a306e3f

Browse files
committed
add small tweak to fix issue 1054
1 parent 61695b6 commit a306e3f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

hls4ml/model/optimizer/passes/convert_to_channels_last.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,11 @@ def transform(self, model, node):
9494
node.add_output_variable(shape, dims)
9595

9696
# Have to transpose back before flattening to get correct order of elements in the flattened tensor
97-
if isinstance(node, Reshape) and len(node.attributes['target_shape']) == 1:
97+
if (
98+
isinstance(node, Reshape)
99+
and len(node.attributes['target_shape']) == 1
100+
and not model.config.config['HLSConfig']['Model']['ChannelsLastConversion'] == "internal"
101+
):
98102
previous_node = node.get_input_node(node.inputs[0])
99103
input = previous_node.name
100104
outshape = previous_node.get_output_variable().shape

0 commit comments

Comments
 (0)