Apply pep604 to `torch/_dynamo` (#175555)
Summary:
Since python>=3.10 is defined in the pyproject.toml, we can enable [pep604](https://peps.python.org/pep-0604/) (in python >=3.10)
Why?
1) Fewer imports making code simpler
2) Standardization - prior to this change, we could have `Optional` or the `| None` intermixed in the codebase
3) Future proof for direction of python type system
X-link: https://github.com/pytorch/pytorch/pull/175555
Approved by: https://github.com/aorenste, https://github.com/zou3519
Reviewed By: jeanschmidt
Differential Revision: D94811748
fbshipit-source-id: ca8ca84d7872b78f3d27e60d7fb8402eeb5c6c54