Clean up some sparse code. (#18962)
authorGregory Chanan <gchanan@fb.com>
Mon, 8 Apr 2019 15:10:19 +0000 (08:10 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Mon, 8 Apr 2019 15:15:42 +0000 (08:15 -0700)
Summary:
1) sparse_dispatches in native_parse was not used anymore, got rid of it.
2) got rid of overloaded sizes_ in SparseTensorImpl, which just uses the base implementation.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/18962

Differential Revision: D14811545

Pulled By: gchanan

fbshipit-source-id: 2fa60ef50456b5f605caa63beae1d8d2542fd527

aten/src/ATen/SparseTensorImpl.cpp
aten/src/ATen/SparseTensorImpl.h
aten/src/ATen/native_parse.py

index ca04de7..89ea262 100644 (file)
@@ -48,9 +48,6 @@ SparseTensorImpl::SparseTensorImpl(at::TensorTypeId type_id, const caffe2::TypeM
   AT_ASSERT(values_.device() == device());
 }
 
-IntArrayRef SparseTensorImpl::sizes() const {
-  return sizes_;
-}
 IntArrayRef SparseTensorImpl::strides() const {
   AT_ERROR("sparse tensors do not have strides");
 }
index 23ba71f..954f2c1 100644 (file)
@@ -40,7 +40,6 @@ public:
   Tensor indices() const { return indices_; }
   Tensor values() const { return values_; }
 
-  IntArrayRef sizes() const override;
   IntArrayRef strides() const override;
   bool is_contiguous() const override;
   int64_t stride(int64_t d) const override;
index dc7c074..266b2bc 100644 (file)
@@ -341,13 +341,6 @@ def parse_return_arguments(return_decl, inplace, func_decl):
     return arguments
 
 
-def has_sparse_dispatches(dispatches):
-    for dispatch in dispatches:
-        if 'Sparse' in dispatch:
-            return True
-    return False
-
-
 def parse_native_yaml(path):
     with open(path, 'r') as f:
         return yaml.load(f, Loader=Loader)