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
6613b175
Commit
6613b175
authored
Dec 27, 2019
by
rusty1s
Browse files
faster rowptr/colptr
parent
a2528a02
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
torch_sparse/storage.py
torch_sparse/storage.py
+6
-2
No files found.
torch_sparse/storage.py
View file @
6613b175
...
@@ -195,7 +195,9 @@ class SparseStorage(object):
...
@@ -195,7 +195,9 @@ class SparseStorage(object):
@
cached_property
@
cached_property
def
rowptr
(
self
):
def
rowptr
(
self
):
rowcount
=
self
.
rowcount
rowcount
=
self
.
rowcount
return
torch
.
cat
([
rowcount
.
new_zeros
(
1
),
rowcount
.
cumsum
(
0
)],
dim
=
0
)
rowptr
=
rowcount
.
new_zeros
(
rowcount
.
numel
()
+
1
)
torch
.
cumsum
(
rowcount
,
dim
=
0
,
out
=
rowptr
[
1
:])
return
rowptr
@
cached_property
@
cached_property
def
colcount
(
self
):
def
colcount
(
self
):
...
@@ -205,7 +207,9 @@ class SparseStorage(object):
...
@@ -205,7 +207,9 @@ class SparseStorage(object):
@
cached_property
@
cached_property
def
colptr
(
self
):
def
colptr
(
self
):
colcount
=
self
.
colcount
colcount
=
self
.
colcount
return
torch
.
cat
([
colcount
.
new_zeros
(
1
),
colcount
.
cumsum
(
0
)],
dim
=
0
)
colptr
=
colcount
.
new_zeros
(
colcount
.
numel
()
+
1
)
torch
.
cumsum
(
colcount
,
dim
=
0
,
out
=
colptr
[
1
:])
return
colptr
@
cached_property
@
cached_property
def
csr2csc
(
self
):
def
csr2csc
(
self
):
...
...
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