Check if a node's normalized aten target matches the given op. Uses get_aten_target_normalized to handle edge dialect ops. This means slice_copy matches slice, etc. Args: node: The node to check op: The op to match (e.g., torch.ops.aten.mul.Tensor)
(node: Node, op: Any)
| 51 | |
| 52 | |
| 53 | def match_target(node: Node, op: Any) -> bool: |
| 54 | """ |
| 55 | Check if a node's normalized aten target matches the given op. |
| 56 | |
| 57 | Uses get_aten_target_normalized to handle edge dialect ops. |
| 58 | This means slice_copy matches slice, etc. |
| 59 | |
| 60 | Args: |
| 61 | node: The node to check |
| 62 | op: The op to match (e.g., torch.ops.aten.mul.Tensor) |
| 63 | """ |
| 64 | return node.op == "call_function" and get_aten_target_normalized(node.target) == op |
| 65 | |
| 66 | |
| 67 | def has_single_user(node: Node) -> bool: |