(node: Node, quantization_config: QuantizationConfig)
| 188 | class 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) |
nothing calls this directly
no test coverage detected