Skip to content

Commit

Permalink
[PyTorch] TensorImpl::is_non_overlapping_and_dense_ should default to…
Browse files Browse the repository at this point in the history
… true (#48625)

Summary:
Pull Request resolved: #48625

The default TensorImpl is contiguous. Therefore, it is non-overlapping and dense per refresh_contiguous().
ghstack-source-id: 118035410

Test Plan: CI

Reviewed By: ezyang

Differential Revision: D25232196

fbshipit-source-id: 1968d9ed444f2ad5414a78d0b11e5d3030e3109d
  • Loading branch information
swolchok authored and facebook-github-bot committed Dec 9, 2020
1 parent a849f38 commit a20d451
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions aten/src/ATen/SparseTensorImpl.cpp
Expand Up @@ -46,6 +46,8 @@ SparseTensorImpl::SparseTensorImpl(at::DispatchKeySet key_set, const caffe2::Typ
AT_ASSERT(values_.sizes() == IntArrayRef({0}));
AT_ASSERT(values_.device() == indices_.device());
AT_ASSERT(values_.device() == device());

is_non_overlapping_and_dense_ = false;
}

IntArrayRef SparseTensorImpl::strides() const {
Expand Down
2 changes: 1 addition & 1 deletion c10/core/TensorImpl.h
Expand Up @@ -1706,7 +1706,7 @@ struct C10_API TensorImpl : public c10::intrusive_ptr_target {
is_channels_last_contiguous_ = false;
is_channels_last_3d_ = false;
is_channels_last_3d_contiguous_ = false;
is_non_overlapping_and_dense_ = false;
is_non_overlapping_and_dense_ = true;
is_wrapped_number_ = false;
allow_tensor_metadata_change_ = true;
reserved_ = false;
Expand Down

0 comments on commit a20d451

Please sign in to comment.