Skip to content

Commit bbc316e

Browse files
committed
purge 3d stream xpose ward in ch_last converter pass
1 parent 49fd6d8 commit bbc316e

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

hls4ml/model/optimizer/passes/convert_to_channels_last.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,13 @@ class ChannelsLastConverter(OptimizerPass):
1212
and adding a transpose layer for the inputs and outputs, if necessary'''
1313

1414
def match(self, node):
15+
# If this parameter has not been set, this model does not need to be converted
16+
if 'ChannelsLastConversion' not in node.model.config.config['HLSConfig']['Model']:
17+
return False # No littering of unused property
1518
if not hasattr(node, 'channels_last_converted'):
1619
return True
1720

1821
def transform(self, model, node):
19-
# If this parameter has not been set, this model does not need to be converted
20-
if 'ChannelsLastConversion' not in model.config.config['HLSConfig']['Model']:
21-
node.channels_last_converted = True
22-
return False
2322
outshape = node.get_output_variable().shape
2423

2524
if isinstance(node, Input):
@@ -103,11 +102,6 @@ def transform(self, model, node):
103102
input = previous_node.name
104103
outshape = previous_node.get_output_variable().shape
105104

106-
if (model.config.config['IOType'] == 'io_stream') and len(outshape) == 3:
107-
raise Exception(
108-
'No 3D transpose available in io_stream, this model cannot be converted to channels-last'
109-
)
110-
111105
if len(outshape) == 2:
112106
attributes = {'perm': [1, 0]}
113107
else:

0 commit comments

Comments
 (0)