[quant][graphmode][refactor] Support filter function in quant fusion patterns (#35333)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/35333
Test Plan:
regression tests in: python test/test_jit.py
Imported from OSS
Differential Revision: D20655312
fbshipit-source-id: 50b937bc56aff93f20fe9a0079bf3aec50f6d25d