[jit] Polymorphic IValue::type() for DynamicType. (#70120)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/70120
Before the change:
```
c10::Type t = ivalue.type();
```
After the change:
```
c10::Type t = ivalue.type();
c10::DynamicType d = ivalue.type<c10::DynamicType>(); // new path
```
The new path will be adopted in PyTorch Lite Interpreter to support lightweight type reflection. Note that type getters are selected at compile time so no performance overhead. The benefits of having a DynamicType will be elaborated in a separate document, but in short, DynamicType provides an isolated type system for controlling binary size bloat, and shrink down ~20 supported Type symbols into one so that the size taken by specializations and function name symbols are greatly reduced.
Lite Interpreter should only use the `<DynamicType>` variant of the interfaces from aten, to reduce binary size.
ghstack-source-id: 146727334
(Note: this ignores all push blocking failures!)
Test Plan: CI
Reviewed By: gmagogsfm
Differential Revision: D33102276
fbshipit-source-id: c5354e7d88f9de260c9b02636214b40fe15f8a10