Removing tensor.data usage in utils with tensor set_ method (#63867)
authorAayush Prakash <aayushp@fb.com>
Tue, 24 Aug 2021 18:19:34 +0000 (11:19 -0700)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Tue, 24 Aug 2021 18:20:44 +0000 (11:20 -0700)
commitd08a36f831cbcb4516fc1b68e3e3deff8ab45aba
tree3d147809faaa8493b354a9c256f5b421125fcca7
parent73431449b357de30ccb5a775c7395f343cb24d73
Removing tensor.data usage in utils with tensor set_ method (#63867)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/63867

When updating the model parameter, updating `parameter.data` is no longer recommended, because this `data` field will be deprecated in the future.

The replacement is `tensor.set_`.

ghstack-source-id: 136531233

Test Plan: buck test mode/dev-nosan //caffe2/test/distributed:distributed_nccl_spawn -- test_periodic_model_averager

Reviewed By: SciPioneer

Differential Revision: D30513613

fbshipit-source-id: 402efb9c30fafc3f285bebc631639f656ceae585
torch/distributed/algorithms/model_averaging/utils.py