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

Function match_target

backends/mlx/pattern_utils.py:53–64  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

51
52
53def 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
67def has_single_user(node: Node) -> bool:

Callers 10

maybe_createMethod · 0.90
maybe_createMethod · 0.90
maybe_createMethod · 0.90
maybe_createMethod · 0.90
maybe_createMethod · 0.90
maybe_createMethod · 0.90
maybe_createMethod · 0.90
matchesMethod · 0.85

Calls 1

Tested by 2