From 68f80ea063d2f47f21754f31485e02bac57f9f25 Mon Sep 17 00:00:00 2001 From: Jovan Mitrevski Date: Fri, 15 Nov 2024 15:20:09 -0600 Subject: [PATCH 1/2] remove incorrect setting of result_t --- hls4ml/model/optimizer/passes/linear.py | 1 - 1 file changed, 1 deletion(-) diff --git a/hls4ml/model/optimizer/passes/linear.py b/hls4ml/model/optimizer/passes/linear.py index b1aee7adc7..ce0308eb66 100644 --- a/hls4ml/model/optimizer/passes/linear.py +++ b/hls4ml/model/optimizer/passes/linear.py @@ -40,7 +40,6 @@ def transform(self, model, node): # if the activation has a quantizer (usually from a QONNX Quant node), set the previous node's output precision if quantizer is not None: prev_node.set_attr("quantizer", quantizer) - prev_node.types['result_t'] = quantizer.hls_type prev_node.get_output_variable().type.precision = quantizer.hls_type model.remove_node(node) return True From 18fc2b8b7484ad1a37f2c423b060de3bc5c95149 Mon Sep 17 00:00:00 2001 From: Jovan Mitrevski Date: Fri, 15 Nov 2024 17:19:33 -0600 Subject: [PATCH 2/2] remove additional incorrect result_t settings --- hls4ml/model/optimizer/passes/merge_const.py | 1 - hls4ml/model/optimizer/passes/quant_opt.py | 2 -- 2 files changed, 3 deletions(-) diff --git a/hls4ml/model/optimizer/passes/merge_const.py b/hls4ml/model/optimizer/passes/merge_const.py index a75ed27aca..bdf7447838 100644 --- a/hls4ml/model/optimizer/passes/merge_const.py +++ b/hls4ml/model/optimizer/passes/merge_const.py @@ -54,7 +54,6 @@ def transform(self, model, node): const_node0.set_attr('quantizer', quantizer) # overwrite the quantizer if quantizer: const_node0.set_attr('quantizer', quantizer) - const_node0.types['result_t'] = quantizer.hls_type const_node0.get_output_variable().type.precision = quantizer.hls_type const_node0.set_attr('value', new_val) diff --git a/hls4ml/model/optimizer/passes/quant_opt.py b/hls4ml/model/optimizer/passes/quant_opt.py index cac29b5040..e2e3d14012 100644 --- a/hls4ml/model/optimizer/passes/quant_opt.py +++ b/hls4ml/model/optimizer/passes/quant_opt.py @@ -194,7 +194,6 @@ def transform(self, model, node): const_node = node.get_input_node(node.inputs[0]) const_node.set_attr('quantizer', quantizer) - const_node.set_attr('result_t', precision) const_node.get_output_variable().type.precision = precision # Should we update the configuration to reflect the new precision? I don't think it's necessary @@ -331,7 +330,6 @@ def transform(self, model, node): const_node.set_attr('value', new_val) const_node.set_attr('quantizer', quantizer) - const_node.types['result_t'].precision = precision const_node.get_output_variable().type.precision = precision inshape = node.get_input_variable().shape