@@ -76,6 +76,9 @@ def test_activation_preserving_with_2_inputs(self, fw_info_mock):
7676 assert not n4 .is_quantization_preserving () and not n4 .is_activation_quantization_enabled ()
7777
7878 def test_node_quantization_by_next_nodes (self , fw_info_mock ):
79+ """
80+ Test that node quantization n_bits is unaffected by preserving next node and not-enabled quantization next node.
81+ """
7982 first_node = build_node ('first_node' )
8083 preserving_node = build_node ('preserving_node' , layer_class = PreservingNode )
8184 no_quant_node = build_node ('no_enabled_quant_node' , layer_class = NoActivationQuantNode )
@@ -113,12 +116,14 @@ def test_node_quantization_by_next_nodes(self, fw_info_mock):
113116 fw_info_mock = Mock (spec = FrameworkInfo , kernel_channels_mapping = {DummyLayer : 0 },
114117 activation_quantizer_mapping = {QuantizationMethod .POWER_OF_TWO : lambda x : 0 },
115118 get_kernel_op_attributes = lambda x : [None ])
116-
117- set_quantization_configs_to_node (first_node , graph , QuantizationConfig () , fw_info_mock , fqc )
118- set_quantization_configs_to_node (preserving_node , graph , QuantizationConfig () , fw_info_mock , fqc )
119- set_quantization_configs_to_node (no_quant_node , graph , QuantizationConfig () , fw_info_mock , fqc )
119+ quantization_config = QuantizationConfig ()
120+ set_quantization_configs_to_node (first_node , graph , quantization_config , fw_info_mock , fqc )
121+ set_quantization_configs_to_node (preserving_node , graph , quantization_config , fw_info_mock , fqc )
122+ set_quantization_configs_to_node (no_quant_node , graph , quantization_config , fw_info_mock , fqc )
120123
121124 assert not first_node .is_quantization_preserving () and first_node .is_activation_quantization_enabled ()
122125 assert preserving_node .is_quantization_preserving () and not preserving_node .is_activation_quantization_enabled ()
123126 assert not no_quant_node .is_quantization_preserving () and not no_quant_node .is_activation_quantization_enabled ()
124127
128+ # assert that first_node n_bits is 16, and isn't affected by its next nodes which supports 8 n_bits only
129+ assert first_node .candidates_quantization_cfg [0 ].activation_quantization_cfg .activation_n_bits == 16
0 commit comments