Skip to content

Commit 6b26c65

Browse files
authored
Merge pull request #1053 from xadupre/perf1
Minor perf gain in graph_matcher.py
2 parents 0c5f97d + 4673fc9 commit 6b26c65

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tf2onnx/graph_matcher.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ def __init__(self, op_type, name=None, inputs=None):
5050
input_pattern if isinstance(input_pattern, OpTypePattern) else
5151
OpTypePattern(input_pattern) for input_pattern in inputs
5252
]
53+
self.op_type_set = set(op_type.split('|')) if op_type else set()
5354

5455
@property
5556
def op_type(self):
@@ -154,7 +155,7 @@ def _is_op_type_same(op, pattern):
154155
if pattern.op_type == "*":
155156
return True
156157

157-
if op.type in pattern.op_type.split('|'):
158+
if op.type in pattern.op_type_set:
158159
return True
159160

160161
return False

0 commit comments

Comments
 (0)