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

Method annotate

backends/qualcomm/quantizer/annotators/htp_rules.py:190–219  ·  view source on GitHub ↗
(node: Node, quantization_config: QuantizationConfig)

Source from the content-addressed store, hash-verified

188class BatchNorm(GeneralOpDef):
189 @staticmethod
190 def annotate(node: Node, quantization_config: QuantizationConfig) -> None:
191 act, weight, bias = node.args[0:3]
192 if _is_annotated([node]):
193 return
194
195 annotated_args = [act]
196 annotate_input_qspec_map(
197 node,
198 act,
199 quantization_config.input_activation,
200 )
201 # QNN requires uint8 instead of int8 in 'weight' config
202 if weight is not None:
203 annotate_input_qspec_map(
204 node,
205 weight,
206 quantization_config.input_activation,
207 )
208 annotated_args.append(weight)
209
210 if bias is not None:
211 annotate_input_qspec_map(
212 node,
213 bias,
214 quantization_config.bias,
215 )
216 annotated_args.append(bias)
217
218 annotate_output_qspec(node, quantization_config.output_activation)
219 _mark_nodes_as_annotated([node, *annotated_args])
220
221
222@register_annotator([torch.ops.aten.to.dtype], QnnConstants.OpCast.op_name)

Callers

nothing calls this directly

Calls 4

_is_annotatedFunction · 0.90
annotate_output_qspecFunction · 0.90
_mark_nodes_as_annotatedFunction · 0.90
appendMethod · 0.45

Tested by

no test coverage detected