[reland]Replace AutoNonVariableTypeMode with InferenceMode in static runtime. (#55731)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/55731
Forgot to export the diff in my last one. Retry...
Test Plan:
https://www.internalfb.com/intern/aibench/details/3752129704
https://www.internalfb.com/intern/aibench/details/1306815519
Reviewed By: hlu1
Differential Revision: D27694660
fbshipit-source-id: b351338fa789b9e9c7337df9b1bc1bc0fc387f5d