Mark a node as annotated. Create an empty ``QuantizationAnnotation`` on the node when missing and set its ``_annotated`` flag to True. Args: node (Node): FX node to update.
(node: Node)
| 76 | |
| 77 | |
| 78 | def mark_node_as_annotated(node: Node) -> None: |
| 79 | """Mark a node as annotated. |
| 80 | |
| 81 | Create an empty ``QuantizationAnnotation`` on the node when missing and set |
| 82 | its ``_annotated`` flag to True. |
| 83 | |
| 84 | Args: |
| 85 | node (Node): FX node to update. |
| 86 | |
| 87 | """ |
| 88 | if Q_ANNOTATION_KEY not in node.meta: |
| 89 | node.meta[Q_ANNOTATION_KEY] = QuantizationAnnotation() |
| 90 | annotation_info = ArmAnnotationInfo( |
| 91 | quantized=True, |
| 92 | ) |
| 93 | node.meta[Q_ANNOTATION_KEY]._annotated = True |
| 94 | meta_custom = node.meta.get("custom", {}) |
| 95 | meta_custom[ArmAnnotationInfo.CUSTOM_META_KEY] = dict(annotation_info) |
| 96 | node.meta["custom"] = meta_custom |
| 97 | |
| 98 | |
| 99 | def has_float_output(node: Node) -> bool: |
no test coverage detected