Deeploy.CommonExtensions.OptimizationPasses.Matchers.Match
- class Deeploy.CommonExtensions.OptimizationPasses.Matchers.Match(anchor: Node, nodes_map: Dict[str, Node])
Bases:
NamedTupleRepresents a successful pattern match in a computational graph.
This named tuple encapsulates the result of matching a pattern graph against a larger computational graph. It contains both the anchor node (starting point of the match) and a complete mapping between pattern nodes and their corresponding matched nodes in the target graph.
- Variables:
anchor (gs.Node) – The node in the target graph that serves as the starting point for the pattern match. This is typically the first node that matched the pattern and from which the full match was discovered.
nodes_map (Dict[str, gs.Node]) – A dictionary mapping pattern node names to their corresponding matched nodes in the target graph. The keys are pattern node names and the values are the actual matched nodes from the target graph.
Notes
This class is used by pattern matching algorithms to represent successful matches. The nodes_map provides a complete correspondence between the pattern structure and the matched subgraph, enabling transformations and optimizations to be applied to the matched regions.
Methods
- __init__()
__init__()count(value, /)Return number of occurrences of value.
index(value[, start, stop])Return first index of value.
Attributes
Alias for field number 0
Alias for field number 1
- anchor: Node
Alias for field number 0
- nodes_map: Dict[str, Node]
Alias for field number 1
- count(value, /)
Return number of occurrences of value.
- index(value, start=0, stop=9223372036854775807, /)
Return first index of value.
Raises ValueError if the value is not present.