Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions onnxscript/rewriter/_matcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,12 @@ def _match_node(self, pattern_node: _pattern_ir.NodePattern, node: ir.Node) -> b
return False

for i, output_value_pattern in enumerate(pattern_node.outputs):
# When trying to bind more outputs (from the pattern) than there are
# actual outputs of the candidate node, reject the node before even
# trying to index into the list of node outputs.
if i >= len(node.outputs):
return False

if not self._match.bind_value(output_value_pattern, node.outputs[i]):
return False

Expand Down
Loading