Expunge use of type() from SparseTensor.
authorEdward Yang <ezyang@fb.com>
Fri, 30 Nov 2018 00:01:46 +0000 (16:01 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Fri, 30 Nov 2018 00:04:18 +0000 (16:04 -0800)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/14546

Reviewed By: gchanan

Differential Revision: D13258512

fbshipit-source-id: b2d562b6c5228288f60f02beab3c44c50163248f

aten/src/ATen/native/sparse/SparseTensor.cpp

index 868aadf..ce69e5c 100644 (file)
@@ -290,7 +290,7 @@ SparseTensor dense_to_sparse(const Tensor& self, int64_t sparse_dim){
   AT_CHECK(sparse_dim > 0, "sparse_dim must be >0");
   AT_CHECK(sparse_dim <= dims, 
     "sparse_dim must be less than or equal to self.dim()");
-  at::TensorOptions sparse_options = self.type().toSparse().options();
+  at::TensorOptions sparse_options = self.options().layout(kSparse);
   std::vector<int64_t> sizes = self.sizes().vec();
 
   Tensor nz = self.nonzero().transpose(0, 1);