Fix the duplication problem in _unique_state_dict (#18139)
authorLu Fang <lufang@fb.com>
Thu, 4 Apr 2019 06:14:07 +0000 (23:14 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Thu, 4 Apr 2019 06:16:44 +0000 (23:16 -0700)
commit0c237f1383abdddcfe7dcaa00af7fc075ddb8d67
treeedb268756a6c36c9055b19502e922bc180e8011b
parentfa0ad057f8b0b16500a00ec874fcaa733e0287e3
Fix the duplication problem in _unique_state_dict (#18139)

Summary:
Since parameter.data will create a new torch.Tensor each time, we get duplicate tensors when call _unique_state_dict now. Try to deduplicate it before creating new tensor.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/18139

Reviewed By: dzhulgakov

Differential Revision: D14511262

Pulled By: houseroad

fbshipit-source-id: cb69795d0b6509721220650bbb19edeb3459a503
test/test_jit.py
torch/jit/__init__.py