[Profiler] Define pattern matcher structure (#80108)
Differential Revision: [D37535663](https://our.internmc.facebook.com/intern/diff/D37535663)
Summary:
I define a base Pattern and some helper function in this commit
Test Plan:
Added test in test_profiler.py
Pull Request resolved: https://github.com/pytorch/pytorch/pull/80108
Approved by: https://github.com/robieta