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

Method get_anchors

backends/nxp/quantizer/patterns.py:118–138  ·  view source on GitHub ↗
(
        self, gm: fx.GraphModule, fused_partition: list[fx.GraphModule]
    )

Source from the content-addressed store, hash-verified

116 pass
117
118 def get_anchors(
119 self, gm: fx.GraphModule, fused_partition: list[fx.GraphModule]
120 ) -> PartitionAnchors | None:
121 node = fused_partition[0].nodes[-1]
122 assert len(fused_partition[0].input_nodes) == 1
123 prev_node = fused_partition[0].input_nodes[0]
124
125 # Previous node was not quantized => we are not able to share q-params
126 if Q_ANNOTATION_KEY not in prev_node.meta:
127 return None
128
129 qspec = SharedQuantizationSpec(prev_node)
130
131 return PartitionAnchors(
132 inputs=[(node, NodeArgsIdx(0))],
133 weights=[],
134 biases=[],
135 output=[
136 (node, qspec),
137 ],
138 )
139
140
141class SingleInputBasicPattern(QuantizationPattern):

Callers

nothing calls this directly

Calls 2

NodeArgsIdxClass · 0.85
PartitionAnchorsClass · 0.70

Tested by

no test coverage detected