44 const size_t num_rois = rois.
shape()[1];
45 const size_t values_per_roi = rois.
shape()[0];
57 const int width =
src.shape()[0];
58 const int height =
src.shape()[1];
64 const auto *rois_ptr =
reinterpret_cast<const uint16_t *
>(rois.
data());
67 for(
size_t pw = 0; pw < num_rois; ++pw)
69 const unsigned int roi_batch = rois_ptr[values_per_roi * pw];
70 const auto x1 = rois_ptr[values_per_roi * pw + 1];
71 const auto y1 = rois_ptr[values_per_roi * pw + 2];
72 const auto x2 = rois_ptr[values_per_roi * pw + 3];
73 const auto y2 = rois_ptr[values_per_roi * pw + 4];
90 auto region_start_x =
static_cast<int>(std::floor((
static_cast<float>(px) / pooled_w) * roi_width));
91 auto region_end_x =
static_cast<int>(std::floor((
static_cast<float>(px + 1) / pooled_w) * roi_width));
92 auto region_start_y =
static_cast<int>(std::floor((
static_cast<float>(py) / pooled_h) * roi_height));
93 auto region_end_y =
static_cast<int>(std::floor((
static_cast<float>(py + 1) / pooled_h) * roi_height));
95 region_start_x = std::min(std::max(region_start_x + roi_anchor_x, 0), width);
96 region_end_x = std::min(std::max(region_end_x + roi_anchor_x, 0), width);
97 region_start_y = std::min(std::max(region_start_y + roi_anchor_y, 0), height);
98 region_end_y = std::min(std::max(region_end_y + roi_anchor_y, 0), height);
101 if((region_end_x <= region_start_x) || (region_end_y <= region_start_y))
109 float curr_max = -std::numeric_limits<float>::max();
110 for(
int j = region_start_y; j < region_end_y; ++j)
112 for(
int i = region_start_x; i < region_end_x; ++i)
116 curr_max = std::max(in_element, curr_max);
139 SimpleTensor<float> dst_tmp = roi_pool_layer<float>(src_tmp, rois, pool_info, output_qinfo);