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
7517c965
Commit
7517c965
authored
Dec 19, 2019
by
rusty1s
Browse files
is_coalesced
parent
a449f775
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
4 deletions
+14
-4
torch_sparse/storage.py
torch_sparse/storage.py
+14
-4
No files found.
torch_sparse/storage.py
View file @
7517c965
...
...
@@ -37,9 +37,17 @@ class SparseStorage(object):
'rowcount'
,
'rowptr'
,
'colcount'
,
'colptr'
,
'csr2csc'
,
'csc2csr'
]
def
__init__
(
self
,
index
,
value
=
None
,
sparse_size
=
None
,
rowcount
=
None
,
rowptr
=
None
,
colcount
=
None
,
colptr
=
None
,
csr2csc
=
None
,
csc2csr
=
None
,
is_sorted
=
False
):
def
__init__
(
self
,
index
,
value
=
None
,
sparse_size
=
None
,
rowcount
=
None
,
rowptr
=
None
,
colcount
=
None
,
colptr
=
None
,
csr2csc
=
None
,
csc2csr
=
None
,
is_sorted
=
False
):
assert
index
.
dtype
==
torch
.
long
assert
index
.
dim
()
==
2
and
index
.
size
(
0
)
==
2
...
...
@@ -176,7 +184,9 @@ class SparseStorage(object):
return
self
.
csr2csc
.
argsort
()
def
is_coalesced
(
self
):
raise
NotImplementedError
idx
=
self
.
sparse_size
(
1
)
*
self
.
row
+
self
.
col
mask
=
idx
==
torch
.
cat
([
idx
.
new_full
((
1
,
),
-
1
),
idx
[:
-
1
]],
dim
=
0
)
return
not
mask
.
any
().
item
()
def
coalesce
(
self
):
raise
NotImplementedError
...
...
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