MCPcopy Create free account
hub / github.com/pytorch/executorch / annotate_binary

Function annotate_binary

backends/qualcomm/quantizer/rules.py:156–179  ·  view source on GitHub ↗
(node: Node, quantization_config: QuantizationConfig)

Source from the content-addressed store, hash-verified

154
155
156def annotate_binary(node: Node, quantization_config: QuantizationConfig) -> None:
157 if _is_annotated([node]):
158 return
159
160 input_act_qspec = quantization_config.input_activation
161 output_act_qspec = (
162 quantization_config.output_activation if _is_float_tensor(node) else None
163 )
164
165 input_qspec_map = {}
166 input_act0 = node.args[0]
167 if _is_float_tensor(input_act0):
168 input_qspec_map[input_act0] = input_act_qspec
169
170 input_act1 = node.args[1]
171 if _is_float_tensor(input_act1):
172 input_qspec_map[input_act1] = input_act_qspec
173
174 if len(input_qspec_map) > 0 or output_act_qspec is not None:
175 node.meta[Q_ANNOTATION_KEY] = QuantizationAnnotation(
176 input_qspec_map=input_qspec_map,
177 output_qspec=output_act_qspec,
178 _annotated=True,
179 )
180
181
182def annotate_conv(node: Node, quantization_config: QuantizationConfig) -> None:

Callers 15

annotateMethod · 0.90
annotateMethod · 0.90
annotateMethod · 0.90
annotateMethod · 0.90
annotateMethod · 0.90
annotateMethod · 0.90
annotateMethod · 0.90
annotateMethod · 0.90
annotateMethod · 0.90
annotateMethod · 0.90
annotateMethod · 0.90
annotateMethod · 0.90

Calls 2

_is_annotatedFunction · 0.70
_is_float_tensorFunction · 0.70

Tested by

no test coverage detected