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

Method annotate

backends/qualcomm/quantizer/annotators/lpai_rules.py:136–165  ·  view source on GitHub ↗
(node: Node, quantization_config: QuantizationConfig)

Source from the content-addressed store, hash-verified

134class BatchNorm(GeneralOpDef):
135 @staticmethod
136 def annotate(node: Node, quantization_config: QuantizationConfig) -> None:
137 act, weight, bias = node.args[0:3]
138 if _is_annotated([node]):
139 return
140
141 annotated_args = [act]
142 annotate_input_qspec_map(
143 node,
144 act,
145 quantization_config.input_activation,
146 )
147 # QNN requires uint8 instead of int8 in 'weight' config
148 if weight is not None:
149 annotate_input_qspec_map(
150 node,
151 weight,
152 quantization_config.input_activation,
153 )
154 annotated_args.append(weight)
155
156 if bias is not None:
157 annotate_input_qspec_map(
158 node,
159 bias,
160 quantization_config.bias,
161 )
162 annotated_args.append(bias)
163
164 annotate_output_qspec(node, quantization_config.output_activation)
165 _mark_nodes_as_annotated([node, *annotated_args])
166
167
168@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