(
self, gm: fx.GraphModule, fused_partition: list[fx.GraphModule]
)
| 380 | return [torch.ops.aten.cat.default] |
| 381 | |
| 382 | def get_anchors( |
| 383 | self, gm: fx.GraphModule, fused_partition: list[fx.GraphModule] |
| 384 | ) -> PartitionAnchors | None: |
| 385 | node = fused_partition[0].nodes[-1] |
| 386 | |
| 387 | quantized_input = None |
| 388 | for prev_node in node.args[0]: |
| 389 | if "quantization_annotation" in prev_node.meta: |
| 390 | quantized_input = prev_node |
| 391 | break |
| 392 | |
| 393 | if quantized_input is not None: |
| 394 | inputs = [] |
| 395 | for idx, _ in enumerate(node.args[0]): |
| 396 | inputs.append( |
| 397 | (node, NodeArgsIdx(0, idx), SharedQuantizationSpec(quantized_input)) |
| 398 | ) |
| 399 | outputs = [(node, SharedQuantizationSpec(quantized_input))] |
| 400 | |
| 401 | else: |
| 402 | # No previous node was quantized => we are not able to share q-params. The conversion to IR will have to |
| 403 | # re-quantize the inputs if necessary. |
| 404 | inputs = [(node, NodeArgsIdx(0, idx)) for idx in range(len(node.args[0]))] |
| 405 | outputs = [(node,)] |
| 406 | |
| 407 | return PartitionAnchors( |
| 408 | inputs=inputs, |
| 409 | weights=[], |
| 410 | biases=[], |
| 411 | output=outputs, |
| 412 | ) |
| 413 | |
| 414 | |
| 415 | class ClampPattern(SingleInputBasicPattern): |
nothing calls this directly
no test coverage detected