Disallow changing the device of a tensor via set_. (#18832)
authorGregory Chanan <gchanan@fb.com>
Thu, 4 Apr 2019 18:12:13 +0000 (11:12 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Thu, 4 Apr 2019 18:15:37 +0000 (11:15 -0700)
commit8732a1b42ea46fc251369bab4f29332d5e35959e
tree125508b0f1664f5932fef61ec5819fb2911797cf
parent15b318de840de61e2e789c013e34d23819715090
Disallow changing the device of a tensor via set_. (#18832)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/18832
ghimport-source-id: fde4ad90541ba52dfa02bdd83466f17e6541e535

Stack from [ghstack](https://github.com/ezyang/ghstack):
* #18833 [STACK] Cache device on TensorImpl; clean up TensorImpl constructors.
* **#18832 [STACK] Disallow changing the device of a tensor via set_.**
* #18831 [STACK] Stop swapping in Storages of the wrong device for Tensors.

This is necessary to cache the device on a TensorImpl.

Differential Revision: D14766231

fbshipit-source-id: bba61634b2d6252ac0697b96033c9eea680956e8
aten/src/TH/THTensor.cpp
test/test_torch.py
torch/csrc/jit/import.cpp