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
gaoqiong
MIGraphX
Commits
8cced061
Commit
8cced061
authored
Mar 28, 2023
by
Ted Themistokleous
Browse files
Use std::back_inserter instead of push_back in filter_boxes_by_score()
Less code, simple to read.
parent
7785e68e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
src/include/migraphx/op/nonmaxsuppression.hpp
src/include/migraphx/op/nonmaxsuppression.hpp
+8
-8
No files found.
src/include/migraphx/op/nonmaxsuppression.hpp
View file @
8cced061
...
...
@@ -230,8 +230,6 @@ struct nonmaxsuppression
filter_boxes_by_score
(
T
scores_start
,
std
::
size_t
num_boxes
,
double
score_threshold
)
const
{
std
::
vector
<
std
::
pair
<
double
,
int64_t
>>
boxes_heap
;
auto
insert_to_boxes_heap
=
make_function_output_iterator
([
&
](
const
auto
&
x
)
{
boxes_heap
.
push_back
(
x
);
});
int64_t
box_idx
=
0
;
if
(
score_threshold
>
0.0
)
...
...
@@ -239,7 +237,7 @@ struct nonmaxsuppression
transform_if
(
scores_start
,
scores_start
+
num_boxes
,
insert
_to_
boxes_heap
,
std
::
back_
insert
er
(
boxes_heap
)
,
[
&
](
auto
sc
)
{
box_idx
++
;
return
sc
>=
score_threshold
;
...
...
@@ -248,11 +246,13 @@ struct nonmaxsuppression
}
else
{
// score is irrelevant, just push into boxes_heap and make a score-index pair
std
::
transform
(
scores_start
,
scores_start
+
num_boxes
,
insert_to_boxes_heap
,
[
&
](
auto
sc
)
{
box_idx
++
;
return
std
::
make_pair
(
sc
,
box_idx
-
1
);
});
std
::
transform
(
scores_start
,
scores_start
+
num_boxes
,
std
::
back_inserter
(
boxes_heap
),
[
&
](
auto
sc
)
{
box_idx
++
;
return
std
::
make_pair
(
sc
,
box_idx
-
1
);
});
}
std
::
sort
(
std
::
execution
::
par
,
boxes_heap
.
begin
(),
boxes_heap
.
end
());
return
boxes_heap
;
...
...
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