Make tensor key in Dict works in serialization (#25442)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/25442
This make the tensor key in dict works in serialzation by comparing the
tensor keys TensorImpl address directly. Given that we just want to
ensure the ordering be stable when iterating, it should be good enough,
we will need careful consideration if we want to stick with python 3.7
insertion order
Test Plan: Imported from OSS
Differential Revision: D17216377
fbshipit-source-id: 80df17dc2fa9eddd73a66e3979d7f8d7934660c0