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
3369b5f0
Commit
3369b5f0
authored
May 29, 2019
by
rusty1s
Browse files
typos
parent
0580c3f8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
6 deletions
+3
-6
cpu/sampler.cpp
cpu/sampler.cpp
+3
-6
No files found.
cpu/sampler.cpp
View file @
3369b5f0
...
@@ -7,14 +7,11 @@ std::tuple<at::Tensor, at::Tensor> neighbor_sampler(at::Tensor start,
...
@@ -7,14 +7,11 @@ std::tuple<at::Tensor, at::Tensor> neighbor_sampler(at::Tensor start,
at
::
Tensor
cumdeg
,
at
::
Tensor
cumdeg
,
at
::
Tensor
col
,
size_t
size
,
at
::
Tensor
col
,
size_t
size
,
float
factor
)
{
float
factor
)
{
THGenerator
*
generator
=
THGenerator_new
();
THGenerator
*
generator
=
THGenerator_new
();
auto
start_ptr
=
start
.
data
<
int64_t
>
();
auto
start_ptr
=
start
.
data
<
int64_t
>
();
auto
cumdeg_ptr
=
cumdeg
.
data
<
int64_t
>
();
auto
cumdeg_ptr
=
cumdeg
.
data
<
int64_t
>
();
// TODO: size float/int, sampling
std
::
vector
<
int64_t
>
e_ids
;
std
::
vector
<
int64_t
>
e_ids
;
for
(
ptrdiff_t
i
=
0
;
i
<
start
.
size
(
0
);
i
++
)
{
for
(
ptrdiff_t
i
=
0
;
i
<
start
.
size
(
0
);
i
++
)
{
int64_t
low
=
cumdeg_ptr
[
start_ptr
[
i
]];
int64_t
low
=
cumdeg_ptr
[
start_ptr
[
i
]];
...
@@ -47,11 +44,11 @@ std::tuple<at::Tensor, at::Tensor> neighbor_sampler(at::Tensor start,
...
@@ -47,11 +44,11 @@ std::tuple<at::Tensor, at::Tensor> neighbor_sampler(at::Tensor start,
THGenerator_free
(
generator
);
THGenerator_free
(
generator
);
auto
e_id
=
int64_t
len
=
e_ids
.
size
();
torch
::
from_blob
(
e_ids
.
data
(),
{
(
signed
)
e_ids
.
size
()
},
start
.
options
());
auto
e_id
=
torch
::
from_blob
(
e_ids
.
data
(),
{
len
},
start
.
options
())
.
clone
()
;
auto
n_id
=
std
::
get
<
0
>
(
at
::
_unique
(
col
.
index_select
(
0
,
e_id
)));
auto
n_id
=
std
::
get
<
0
>
(
at
::
_unique
(
col
.
index_select
(
0
,
e_id
)));
return
std
::
make_tuple
(
n_id
,
e_id
.
clone
()
);
return
std
::
make_tuple
(
n_id
,
e_id
);
}
}
PYBIND11_MODULE
(
TORCH_EXTENSION_NAME
,
m
)
{
PYBIND11_MODULE
(
TORCH_EXTENSION_NAME
,
m
)
{
...
...
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