pytorch
8a7c9a5e - [quant] Always match the first matchable pattern in fuse (#75047)

Commit
3 years ago
[quant] Always match the first matchable pattern in fuse (#75047) Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/75047 As title, For instance, We match two patterns ``` (add, (bn, conv), matchallnode) (add, matchallnode, (bn, conv)) ``` Against the model ``` conv1 -> bn1 | conv2 -> bn2 + add ``` For the add node, both two patterns passes `is_match` and `apply_match` is executed twice. As a result, both `conv1 -> bn1` and `conv2 -> bn2` will be matched as `(bn, conv)` instead of one `(bn, conv)` one `matchallnode`. To fix this, stop trying all the other pattners once a pattern is matched. Test Plan: verified in D35252100 Reviewed By: jerryzh168 Differential Revision: D35300191 fbshipit-source-id: 383b2eb971d436072e1c28597c5b6a01d0f49c5a (cherry picked from commit 89d08ea2d2840e01ec3dd40da3f58405577c78fc)
Author
Committer
Parents
Loading