eager quant: fix error with removing forward hooks (#49813)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/49813
https://github.com/pytorch/pytorch/issues/49739 reports a crash
where removing forward hooks results in a
```
RuntimeError: OrderedDict mutated during iteration
```
Unfortunately I cannot repro this inside the PyTorch module, but the issue
author has a good point and and we should not mutate the dict inside
of the iteration.
Test Plan:
```
// test plan from https://github.com/pytorch/pytorch/pull/46871 which
// originally added this
python test/test_quantization.py TestEagerModeQATOps
```
Imported from OSS
Reviewed By: jerryzh168
Differential Revision: D25698725
fbshipit-source-id: 13069d0d5017a84038c8f7be439a3ed537938ac6