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
904b1d48
Commit
904b1d48
authored
Feb 19, 2020
by
rusty1s
Browse files
cached keys
parent
6e9cd9d6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
8 deletions
+15
-8
torch_sparse/metis.py
torch_sparse/metis.py
+4
-0
torch_sparse/storage.py
torch_sparse/storage.py
+11
-8
No files found.
torch_sparse/metis.py
View file @
904b1d48
...
...
@@ -18,3 +18,7 @@ def partition_kway(
partptr
=
torch
.
ops
.
torch_sparse
.
ind2ptr
(
cluster
,
num_parts
)
return
out
,
partptr
,
perm
SparseTensor
.
partition_kway
=
lambda
self
,
num_parts
:
partition_kway
(
self
,
num_parts
)
torch_sparse/storage.py
View file @
904b1d48
...
...
@@ -379,19 +379,22 @@ class SparseStorage(object):
self
.
_csc2csr
=
None
return
self
def
num_
cached_keys
(
self
)
->
int
:
count
=
0
def
cached_keys
(
self
)
->
List
[
str
]
:
keys
:
List
[
str
]
=
[]
if
self
.
has_rowcount
():
count
+=
1
keys
.
append
(
'rowcount'
)
if
self
.
has_colptr
():
count
+=
1
keys
.
append
(
'colptr'
)
if
self
.
has_colcount
():
count
+=
1
keys
.
append
(
'colcount'
)
if
self
.
has_csr2csc
():
count
+=
1
keys
.
append
(
'csr2csc'
)
if
self
.
has_csc2csr
():
count
+=
1
return
count
keys
.
append
(
'csc2csr'
)
return
keys
def
num_cached_keys
(
self
)
->
int
:
return
len
(
self
.
cached_keys
())
def
copy
(
self
):
return
SparseStorage
(
row
=
self
.
_row
,
rowptr
=
self
.
_rowptr
,
col
=
self
.
_col
,
...
...
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