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
26ad6ce9
Commit
26ad6ce9
authored
Aug 05, 2018
by
rusty1s
Browse files
better vec gen
parent
3bf93538
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
torch_sparse/coalesce.py
torch_sparse/coalesce.py
+1
-1
No files found.
torch_sparse/coalesce.py
View file @
26ad6ce9
...
...
@@ -9,7 +9,7 @@ def coalesce(index, value, size, op='add', fill_value=0):
unique
,
inv
=
torch
.
unique
(
row
*
n
+
col
,
sorted
=
True
,
return_inverse
=
True
)
perm
=
torch
.
arange
(
inv
.
size
(
0
),
dtype
=
inv
.
dtype
,
device
=
inv
.
device
)
perm
=
inv
.
new_empty
(
inv
.
max
().
item
()
+
1
).
scatter_
(
0
,
inv
,
perm
)
perm
=
inv
.
new_empty
(
unique
.
size
(
0
)
).
scatter_
(
0
,
inv
,
perm
)
index
=
torch
.
stack
([
row
[
perm
],
col
[
perm
]],
dim
=
0
)
if
value
is
not
None
:
...
...
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