Skip to content

Commit 5254d97

Browse files
committed
warn double quantizer
1 parent 93507e8 commit 5254d97

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

hls4ml/model/optimizer/passes/hgq_proxy_model.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,14 @@ def match(self, node: Layer):
9090
def propagate(self, node: Layer, precision: FixedPrecisionType):
9191
from hls4ml.model.optimizer.passes.bit_exact import get_input_layers, get_output_layers
9292

93+
if node.attributes.get('result_t_propagated', False):
94+
msg = f'result_t for {node.name} propagated multiple times. \
95+
Bit-exactness may be compromised. Consider void using consecutive quantizers in your model.'
96+
warn(msg, stacklevel=1)
97+
9398
node.get_output_variable().type.precision = precision
94-
node.attributes.attributes['result_t'].precision = precision
99+
node.attributes['result_t'].precision = precision
100+
node.attributes['result_t_propagated'] = True
95101

96102
if not isinstance(node, Reshape):
97103
return node

0 commit comments

Comments
 (0)