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