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

Function mark_node_as_annotated

backends/arm/quantizer/arm_quantizer_utils.py:78–96  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

76
77
78def 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
99def has_float_output(node: Node) -> bool:

Callers 3

_annotate_ioMethod · 0.90
_annotate_inputFunction · 0.70
annotate_graphFunction · 0.70

Calls 2

ArmAnnotationInfoClass · 0.90
getMethod · 0.45

Tested by

no test coverage detected