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
e0c91397
Commit
e0c91397
authored
Nov 07, 2020
by
rusty1s
Browse files
fix
parent
436b2e50
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
5 deletions
+4
-5
torch_sparse/tensor.py
torch_sparse/tensor.py
+4
-5
No files found.
torch_sparse/tensor.py
View file @
e0c91397
...
...
@@ -282,10 +282,9 @@ class SparseTensor(object):
idx
[
row
.
numel
()
+
1
:]
+=
row
idx
,
perm
=
idx
.
sort
()
perm
=
perm
[
1
:].
sub_
(
1
)
mask
=
idx
[
1
:]
>
idx
[:
-
1
]
idx2
=
perm
[
mask
]
perm
=
perm
[
1
:].
sub_
(
1
)
idx
=
perm
[
mask
]
if
value
is
not
None
:
ptr
=
mask
.
nonzero
().
flatten
()
...
...
@@ -293,8 +292,8 @@ class SparseTensor(object):
value
=
torch
.
cat
([
value
,
value
])[
perm
]
value
=
segment_csr
(
value
,
ptr
,
reduce
=
reduce
)
new_row
=
torch
.
cat
([
row
,
col
],
dim
=
0
,
out
=
perm
)[
idx
2
]
new_col
=
torch
.
cat
([
col
,
row
],
dim
=
0
,
out
=
perm
)[
idx
2
]
new_row
=
torch
.
cat
([
row
,
col
],
dim
=
0
,
out
=
perm
)[
idx
]
new_col
=
torch
.
cat
([
col
,
row
],
dim
=
0
,
out
=
perm
)[
idx
]
out
=
SparseTensor
(
row
=
new_row
,
rowptr
=
None
,
col
=
new_col
,
value
=
value
,
sparse_sizes
=
(
N
,
N
),
is_sorted
=
True
)
...
...
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