Skip to content

Commit 647154f

Browse files
gchananfacebook-github-bot
authored andcommitted
Assert tensor isn't sparse in enforce_invariants. (pytorch#18338)
Summary: There's no reason we can't check this, but I'm punting on implementing it for now. But it currently segfaults, so this is an improvements. Pull Request resolved: pytorch#18338 Differential Revision: D14580308 Pulled By: gchanan fbshipit-source-id: 44d4cafeab12e1beeb3453a2d4068d221c2e9c4f
1 parent a4f83ff commit 647154f

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

aten/src/ATen/core/Tensor.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ void Tensor::enforce_invariants() {
1919
AT_ASSERTM(
2020
impl_->dtype_initialized(),
2121
"Partially-initialized tensor not supported by at::Tensor");
22+
AT_ASSERTM(
23+
!impl_->is_sparse(),
24+
"Sparse Tensors are supported by at::Tensor, but invariant checking isn't implemented. Please file a bug.");
2225
AT_ASSERTM(
2326
impl_->storage_initialized(),
2427
"Partially-initialized tensor not supported by at::Tensor");

0 commit comments

Comments
 (0)