Skip to content

Commit d59d246

Browse files
committed
handle stray inputs
1 parent 72a8d64 commit d59d246

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

hls4ml/model/optimizer/passes/bit_exact.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,13 @@ def match(self, node: Layer):
574574

575575
def transform(self, model, node: Layer):
576576
out_layers: list[FixedPointQuantizer] = get_output_layers(node)
577+
578+
if len(out_layers) == 0: # Input connected to nothing
579+
new_type = to_hls4ml_fixed(0, 0, 1, f'{node.name}_t')
580+
node.get_output_variable().type = new_type
581+
node.model.config.layer_name_precision[node.name] = str(new_type)
582+
return False
583+
577584
if not all(isinstance(l, FixedPointQuantizer) for l in out_layers):
578585
warn(f'Input {node.name} has unhandled high precision. Consider setting it manually before synthesising.')
579586
return False

0 commit comments

Comments
 (0)