Use static type information to restore type tags (#25447)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/25447
When we unpickle IValues, we lose type information for List[T]
and Dict[K, V]. We can restore this information using the static
type information contained in the top-level Module/Class type.
This ensures that even after serialization we can always get the
dynamic type of an ivalue using its type() method.
Test Plan: Imported from OSS
Differential Revision: D17127872
Pulled By: zdevito
fbshipit-source-id: 1ffb5e37a7c35c71ac9d3fb7b2edbc7ce3fbec72