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
d4fe021d
Commit
d4fe021d
authored
May 21, 2020
by
Alexander Liao
Browse files
attempting to fix win/os build error
parent
d7f704c5
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
3 additions
and
25 deletions
+3
-25
csrc/cpu/radius_cpu.cpp
csrc/cpu/radius_cpu.cpp
+2
-2
csrc/cpu/utils/neighbors.cpp
csrc/cpu/utils/neighbors.cpp
+0
-23
csrc/cpu/utils/neighbors.h
csrc/cpu/utils/neighbors.h
+1
-0
No files found.
csrc/cpu/radius_cpu.cpp
View file @
d4fe021d
...
@@ -63,8 +63,8 @@ torch::Tensor batch_radius_cpu(torch::Tensor query,
...
@@ -63,8 +63,8 @@ torch::Tensor batch_radius_cpu(torch::Tensor query,
float
radius
,
int
max_num
)
{
float
radius
,
int
max_num
)
{
torch
::
Tensor
out
;
torch
::
Tensor
out
;
auto
data_qb
=
query_batch
.
data_ptr
<
long
>
();
auto
data_qb
=
query_batch
.
data_ptr
<
int64_t
>
();
auto
data_sb
=
support_batch
.
data_ptr
<
long
>
();
auto
data_sb
=
support_batch
.
data_ptr
<
int64_t
>
();
std
::
vector
<
long
>
query_batch_stl
=
std
::
vector
<
long
>
(
data_qb
,
data_qb
+
query_batch
.
size
(
0
));
std
::
vector
<
long
>
query_batch_stl
=
std
::
vector
<
long
>
(
data_qb
,
data_qb
+
query_batch
.
size
(
0
));
std
::
vector
<
long
>
size_query_batch_stl
;
std
::
vector
<
long
>
size_query_batch_stl
;
get_size_batch
(
query_batch_stl
,
size_query_batch_stl
);
get_size_batch
(
query_batch_stl
,
size_query_batch_stl
);
...
...
csrc/cpu/utils/neighbors.cpp
View file @
d4fe021d
...
@@ -7,17 +7,11 @@ template<typename scalar_t>
...
@@ -7,17 +7,11 @@ template<typename scalar_t>
int
nanoflann_neighbors
(
vector
<
scalar_t
>&
queries
,
vector
<
scalar_t
>&
supports
,
int
nanoflann_neighbors
(
vector
<
scalar_t
>&
queries
,
vector
<
scalar_t
>&
supports
,
vector
<
long
>&
neighbors_indices
,
float
radius
,
int
dim
,
int
max_num
){
vector
<
long
>&
neighbors_indices
,
float
radius
,
int
dim
,
int
max_num
){
// Initiate variables
// ******************
const
scalar_t
search_radius
=
static_cast
<
scalar_t
>
(
radius
*
radius
);
const
scalar_t
search_radius
=
static_cast
<
scalar_t
>
(
radius
*
radius
);
// Counting vector
// Counting vector
size_t
max_count
=
1
;
size_t
max_count
=
1
;
// Nanoflann related variables
// ***************************
// CLoud variable
// CLoud variable
PointCloud
<
scalar_t
>
pcd
;
PointCloud
<
scalar_t
>
pcd
;
pcd
.
set
(
supports
,
dim
);
pcd
.
set
(
supports
,
dim
);
...
@@ -54,32 +48,15 @@ int nanoflann_neighbors(vector<scalar_t>& queries, vector<scalar_t>& supports,
...
@@ -54,32 +48,15 @@ int nanoflann_neighbors(vector<scalar_t>& queries, vector<scalar_t>& supports,
scalar_t
*
query_pt
=
new
scalar_t
[
dim
];
scalar_t
*
query_pt
=
new
scalar_t
[
dim
];
std
::
copy
(
p0
.
begin
(),
p0
.
end
(),
query_pt
);
std
::
copy
(
p0
.
begin
(),
p0
.
end
(),
query_pt
);
//for(int i=0; i < p0.size(); i++)
//std::cout << query_pt[i] << '\n';
list_matches
[
i0
].
reserve
(
max_count
);
list_matches
[
i0
].
reserve
(
max_count
);
std
::
vector
<
std
::
pair
<
size_t
,
scalar_t
>
>
ret_matches
;
std
::
vector
<
std
::
pair
<
size_t
,
scalar_t
>
>
ret_matches
;
const
size_t
nMatches
=
index
->
radiusSearch
(
query_pt
,
search_radius
+
eps
,
ret_matches
,
search_params
);
const
size_t
nMatches
=
index
->
radiusSearch
(
query_pt
,
search_radius
+
eps
,
ret_matches
,
search_params
);
//cout << "radiusSearch(): radius=" << search_radius << " -> " << nMatches << " matches\n";
//for (size_t i = 0; i < nMatches; i++)
// cout << "idx["<< i << "]=" << ret_matches[i].first << " dist["<< i << "]=" << ret_matches[i].second << endl;
//cout << "\n";
list_matches
[
i0
]
=
ret_matches
;
list_matches
[
i0
]
=
ret_matches
;
if
(
max_count
<
nMatches
)
max_count
=
nMatches
;
if
(
max_count
<
nMatches
)
max_count
=
nMatches
;
i0
++
;
i0
++
;
// Get worst (furthest) point, without sorting:
// cout << "\n neighbors: " << nMatches << "\n";
// Get worst (furthest) point, without sorting:
// for(int i=0; i < ret_matches.size(); i++)
// std::cout << ret_matches.at(i) << '\n';
}
}
// Reserve the memory
// Reserve the memory
if
(
max_num
>
0
)
{
if
(
max_num
>
0
)
{
...
...
csrc/cpu/utils/neighbors.h
View file @
d4fe021d
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
#include "nanoflann.hpp"
#include "nanoflann.hpp"
#include <set>
#include <set>
#include <cstdint>
#include <cstdint>
#include <thread>
using
namespace
std
;
using
namespace
std
;
...
...
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