Skip to content

Commit 7612b4f

Browse files
authored
Merge pull request #1119 from fastmachinelearning/make_Constant_without_input
remove incorrect input from Constant nodes
2 parents 2c17f66 + 97d7186 commit 7612b4f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

hls4ml/model/layers.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ def initialize(self):
357357

358358

359359
class Constant(Layer):
360-
# one could consider making this a weight attribute, but given it's transient nature, I am not sure it helps
360+
# one could consider making this a weight attribute, but given its transient nature, I am not sure it helps
361361
_expected_attributes = [
362362
Attribute('value', value_type=np.ndarray),
363363
]
@@ -371,6 +371,10 @@ def initialize(self):
371371
dims = [f'{self.name}_{i}' for i in range(len(shape))]
372372
quantizer = self.get_attr('quantizer')
373373

374+
# the graph._make_graph function sets the input node to the previous node
375+
# if it is not set. That is incorrect for Constant nodes, so remove the input node
376+
self.inputs = []
377+
374378
# Should the else clause below be None or UnspecifiedPrecisionType
375379
precision = quantizer.hls_type if quantizer is not None else UnspecifiedPrecisionType()
376380

0 commit comments

Comments
 (0)