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
bcc8106e
Commit
bcc8106e
authored
May 15, 2020
by
rusty1s
Browse files
avg_bandwidth
parent
220672ec
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
torch_sparse/tensor.py
torch_sparse/tensor.py
+6
-2
No files found.
torch_sparse/tensor.py
View file @
bcc8106e
...
...
@@ -260,6 +260,10 @@ class SparseTensor(object):
row
,
col
,
_
=
self
.
coo
()
return
int
((
row
-
col
).
abs_
().
max
())
def
avg_bandwidth
(
self
)
->
float
:
row
,
col
,
_
=
self
.
coo
()
return
float
((
row
-
col
).
abs_
().
to
(
torch
.
float
).
mean
())
def
bandwidth_proportion
(
self
,
bandwidth
:
int
)
->
float
:
row
,
col
,
_
=
self
.
coo
()
tmp
=
(
row
-
col
).
abs_
()
...
...
@@ -537,8 +541,8 @@ SparseTensor.__repr__ = __repr__
# Scipy Conversions ###########################################################
ScipySparseMatrix
=
Union
[
scipy
.
sparse
.
coo_matrix
,
scipy
.
sparse
.
csr_matrix
,
scipy
.
sparse
.
csc_matrix
]
ScipySparseMatrix
=
Union
[
scipy
.
sparse
.
coo_matrix
,
scipy
.
sparse
.
csr_matrix
,
scipy
.
sparse
.
csc_matrix
]
@
torch
.
jit
.
ignore
...
...
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