Type improvements in `_dynamo/utils` to generics (#159824)
Summary:
Follow up to #159580
X-link: https://github.com/pytorch/pytorch/pull/159824
Approved by: https://github.com/williamwen42
Reviewed By: clee2000
Differential Revision: D80269910
fbshipit-source-id: ea2c1313c2c3e0f05048e4810b95e5c2e3c43c53