(node: Node, quantization_config: QuantizationConfig)
| 477 | class LayerNorm(GeneralOpDef): |
| 478 | @staticmethod |
| 479 | def annotate(node: Node, quantization_config: QuantizationConfig) -> None: |
| 480 | act_node = node.args[0] |
| 481 | weight_node = node.args[2] |
| 482 | bias_node = None |
| 483 | if len(node.args) > 2: |
| 484 | bias_node = node.args[3] |
| 485 | |
| 486 | if _is_annotated([node]): |
| 487 | return |
| 488 | input_act_qspec = quantization_config.input_activation |
| 489 | |
| 490 | annotate_input_qspec_map( |
| 491 | node, |
| 492 | act_node, |
| 493 | input_act_qspec, |
| 494 | ) |
| 495 | if input_act_qspec.dtype == torch.int32: |
| 496 | annotate_input_qspec_map( |
| 497 | node, |
| 498 | weight_node, |
| 499 | get_16a16w_qnn_ptq_config().weight, |
| 500 | ) |
| 501 | else: |
| 502 | annotate_input_qspec_map( |
| 503 | node, |
| 504 | weight_node, |
| 505 | input_act_qspec, |
| 506 | ) |
| 507 | nodes_to_mark_annotated = [node, weight_node] |
| 508 | if bias_node: |
| 509 | annotate_input_qspec_map( |
| 510 | node, |
| 511 | bias_node, |
| 512 | quantization_config.bias, |
| 513 | ) |
| 514 | nodes_to_mark_annotated.append(bias_node) |
| 515 | annotate_output_qspec(node, quantization_config.output_activation) |
| 516 | _mark_nodes_as_annotated(nodes_to_mark_annotated) |
| 517 | |
| 518 | |
| 519 | @register_annotator([torch.ops.aten.linalg_vector_norm.default], qnn_op=None) |
nothing calls this directly
no test coverage detected