File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -780,11 +780,11 @@ def _annotate_add(
780
780
if _is_annotated ([add_node ]):
781
781
continue
782
782
783
+ input_act0 = add_node .args [0 ]
783
784
input_act_qspec = get_input_act_qspec (quantization_config )
784
- output_act_qspec = get_output_act_qspec ( quantization_config )
785
+ shared_with_input0_qspec = SharedQuantizationSpec (( input_act0 , add_node ) )
785
786
786
787
input_qspec_map = {}
787
- input_act0 = add_node .args [0 ]
788
788
if isinstance (input_act0 , Node ):
789
789
if _is_input_large_scalar (input_act0 , gm ):
790
790
continue
@@ -798,11 +798,14 @@ def _annotate_add(
798
798
continue
799
799
if _is_input_non_float_tensor (input_act1 ):
800
800
continue
801
- input_qspec_map [input_act1 ] = input_act_qspec
801
+ if input_act0 is not input_act1 :
802
+ input_qspec_map [input_act1 ] = shared_with_input0_qspec
803
+ else :
804
+ input_qspec_map [input_act1 ] = input_act_qspec
802
805
803
806
add_node .meta ["quantization_annotation" ] = QuantizationAnnotation (
804
807
input_qspec_map = input_qspec_map ,
805
- output_qspec = output_act_qspec ,
808
+ output_qspec = shared_with_input0_qspec ,
806
809
_annotated = True ,
807
810
)
808
811
return annotated_partitions
You can’t perform that action at this time.
0 commit comments