Fix a bug in subgraph rewriters. (#35704)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/35704
Due to not clearing nodes_to_delete_, when we try to write graph rewrite
pass with multiple patterns, this is observed:
IndexError: vector::_M_range_check: __n (which is 0) >= this->size() (which is 0)
Test Plan:
The PR stacked on top of this run into this error in the unit test.
Imported from OSS
Differential Revision: D20746593
fbshipit-source-id: 9b55604f49ff2ee2a81a61827880cb679c44607a