MCPcopy
hub / github.com/OpenPPL/ppq / concat_matching

Method concat_matching

ppq/IR/search.py:639–653  ·  view source on GitHub ↗
(
        self, relay_pattern: Callable,
        end_pattern: Callable)

Source from the content-addressed store, hash-verified

637 return dict(activation_matchings)
638
639 def concat_matching(
640 self, relay_pattern: Callable,
641 end_pattern: Callable) -> Dict[str, List[str]]:
642 matchings = self.path_matching(
643 sp_expr = lambda op: op.type in {'Concat'},
644 rp_expr = relay_pattern,
645 ep_expr = end_pattern,
646 direction = 'up'
647 )
648
649 concat_matchings = defaultdict(list)
650 for path in matchings:
651 concat, op = path[0], path[-1]
652 concat_matchings[concat.name].append(op.name)
653 return dict(concat_matchings)
654
655 def pattern_matching(self, patterns: List[Callable],
656 edges: List[List[int]],

Callers 1

optimizeMethod · 0.95

Calls 2

path_matchingMethod · 0.95
appendMethod · 0.45

Tested by

no test coverage detected