Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
torch-sparse
Commits
0adb9cab
Commit
0adb9cab
authored
Jun 21, 2021
by
rusty1s
Browse files
fix max check for row.numel() == 0
parent
a7063092
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
4 deletions
+10
-4
torch_sparse/storage.py
torch_sparse/storage.py
+10
-4
No files found.
torch_sparse/storage.py
View file @
0adb9cab
...
...
@@ -51,17 +51,23 @@ class SparseStorage(object):
if
sparse_sizes
is
None
:
if
rowptr
is
not
None
:
M
=
rowptr
.
numel
()
-
1
elif
row
is
not
None
:
elif
row
is
not
None
and
row
.
numel
()
>
0
:
M
=
row
.
max
().
item
()
+
1
elif
row
is
not
None
and
row
.
numel
()
==
0
:
M
=
0
else
:
raise
ValueError
N
=
col
.
max
().
item
()
+
1
if
col
.
numel
()
>
0
:
N
=
col
.
max
().
item
()
+
1
else
:
N
=
0
sparse_sizes
=
(
int
(
M
),
int
(
N
))
else
:
assert
len
(
sparse_sizes
)
==
2
if
row
is
not
None
:
if
row
is
not
None
and
row
.
numel
()
>
0
:
assert
row
.
max
().
item
()
<
sparse_sizes
[
0
]
assert
col
.
max
().
item
()
<
sparse_sizes
[
1
]
if
col
.
numel
()
>
0
:
assert
col
.
max
().
item
()
<
sparse_sizes
[
1
]
if
row
is
not
None
:
assert
row
.
dtype
==
torch
.
long
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment