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-cluster
Commits
f568f19a
Commit
f568f19a
authored
May 01, 2018
by
rusty1s
Browse files
to int
parent
e1125f13
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
aten/cpu/graclus.cpp
aten/cpu/graclus.cpp
+3
-3
No files found.
aten/cpu/graclus.cpp
View file @
f568f19a
...
...
@@ -7,7 +7,7 @@ inline std::tuple<at::Tensor, at::Tensor> remove_self_loops(at::Tensor row,
}
inline
std
::
tuple
<
at
::
Tensor
,
at
::
Tensor
>
randperm
(
at
::
Tensor
row
,
at
::
Tensor
col
,
int
64_t
num_nodes
)
{
randperm
(
at
::
Tensor
row
,
at
::
Tensor
col
,
int
num_nodes
)
{
// Randomly reorder row and column indices.
auto
perm
=
at
::
randperm
(
torch
::
CPU
(
at
::
kLong
),
row
.
size
(
0
));
row
=
row
.
index_select
(
0
,
perm
);
...
...
@@ -27,14 +27,14 @@ randperm(at::Tensor row, at::Tensor col, int64_t num_nodes) {
return
{
row
,
col
};
}
inline
at
::
Tensor
degree
(
at
::
Tensor
index
,
int
64_t
num_nodes
,
inline
at
::
Tensor
degree
(
at
::
Tensor
index
,
int
num_nodes
,
at
::
ScalarType
scalar_type
)
{
auto
zero
=
at
::
full
(
torch
::
CPU
(
scalar_type
),
{
num_nodes
},
0
);
auto
one
=
at
::
full
(
zero
.
type
(),
{
index
.
size
(
0
)},
1
);
return
zero
.
scatter_add_
(
0
,
index
,
one
);
}
at
::
Tensor
graclus
(
at
::
Tensor
row
,
at
::
Tensor
col
,
int
64_t
num_nodes
)
{
at
::
Tensor
graclus
(
at
::
Tensor
row
,
at
::
Tensor
col
,
int
num_nodes
)
{
std
::
tie
(
row
,
col
)
=
remove_self_loops
(
row
,
col
);
std
::
tie
(
row
,
col
)
=
randperm
(
row
,
col
,
num_nodes
);
...
...
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