Preserve types during empty container assignment (#58911)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/58911
Stack from [ghstack](https://github.com/ezyang/ghstack):
* __->__ #58911
Test Plan: Imported from OSS
Reviewed By: gmagogsfm
Differential Revision: D30785623
Pulled By: ansley
fbshipit-source-id: 4e05d6369318974290fea02ad2bc148293c25090