[JIT] Support device as Dict key (#65079)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/65079
This is required to use RPC DeviceMap aka Dict[torch.device, torch.device] in torchscript
Test Plan: Imported from OSS
Reviewed By: malfet
Differential Revision: D31072626
Pulled By: pbelevich
fbshipit-source-id: 51cfa5653db86de73b624e9157d68d1b319bfc64