Replace calls of Type::_th_tensor. (#14877)
authorGregory Chanan <gchanan@fb.com>
Fri, 7 Dec 2018 20:37:03 +0000 (12:37 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Fri, 7 Dec 2018 21:04:48 +0000 (13:04 -0800)
commitefc5e9f71a059fa72135795bb9ec5aab33b36479
treef882d6e519b7b327507a434abf61e6b5b1d51d2f
parentd6c53328f9c9f0b569f1d32e4df06fdf5b573c66
Replace calls of Type::_th_tensor. (#14877)

Summary:
_th_tensor is moving off Type, so these calls need to be replaced.

Unfortunately, replacing these with a full-fledged solution [e.g. from_storage(..., TensorOptions)] is a bit complicated because the storage itself fully defines the Type (modulo variable).  It's simpler to just wait for the Variable/Tensor merge rather than to solve this now, so instead I changed the call sites to: at::empty({0}, type.options()).set_(storage...).

This isn't great because we are also trying to get rid of Type::options, but this seems to be the lesser-of-two-evils.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/14877

Differential Revision: D13374310

Pulled By: gchanan

fbshipit-source-id: eb953ed041507e6190d6f32e383912e5a08311cd
aten/src/ATen/templates/TypeDefault.cpp
torch/csrc/jit/export.cpp
torch/csrc/jit/import.cpp