Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rectify flipped coordinate_transformation_mode logic in ROIAlign #2159

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/include/migraphx/op/roialign.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ struct roialign
{
xy[ii] = roi_start[ii] + p[ii] * bin_size[ii] +
(i[ii] + .5f) * bin_size[ii] / bin_grid_size[ii];
xy[ii] = (coord_trans_mode == "output_half_pixel") ? (xy[ii] - 0.5f) : xy[ii];
xy[ii] = (coord_trans_mode == "half_pixel") ? (xy[ii] - 0.5f) : xy[ii];
if(xy[ii] < -1.0 or xy[ii] > dims[ii])
{
results[index] = pos_weight{};
Expand Down
2 changes: 1 addition & 1 deletion src/targets/gpu/jit/roialign.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ struct roialign_compiler : compiler<roialign_compiler>

// coord_trans_mode
auto ctm = v.at("coordinate_transformation_mode").to<std::string>();
float rois_offset = (ctm == "output_half_pixel") ? -0.5f : 0.0f;
float rois_offset = (ctm == "half_pixel") ? -0.5f : 0.0f;
options.params += " -DROIS_OFFSET=" + std::to_string(rois_offset);

// spatial_scale
Expand Down
8 changes: 4 additions & 4 deletions test/ref/roialign.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ TEST_CASE(roialign_out_of_bound_test)
};

{
auto p = create_program("output_half_pixel");
auto p = create_program("half_pixel");
p.compile(migraphx::make_target("ref"));
auto result = p.eval({}).back();
std::vector<float> results_vector;
Expand Down Expand Up @@ -130,7 +130,7 @@ TEST_CASE(roialign_test)
};

{
auto p = create_program();
auto p = create_program("output_half_pixel");
p.compile(migraphx::make_target("ref"));
auto result = p.eval({}).back();
std::vector<float> results_vector;
Expand All @@ -154,7 +154,7 @@ TEST_CASE(roialign_test)
}

{
auto p = create_program("output_half_pixel");
auto p = create_program("half_pixel");
p.compile(migraphx::make_target("ref"));
auto result = p.eval({}).back();
std::vector<float> results_vector;
Expand All @@ -175,7 +175,7 @@ TEST_CASE(roialign_test)
}

{
auto p = create_program("output_half_pixel", migraphx::op::pooling_mode::max, 0);
auto p = create_program("half_pixel", migraphx::op::pooling_mode::max, 0);
p.compile(migraphx::make_target("ref"));
auto result = p.eval({}).back();
std::vector<float> results_vector;
Expand Down
Loading