42 const int num_anchors = anchors.
shape()[1];
43 const auto width = int(
info.feat_width());
44 const auto height = int(
info.feat_height());
45 const float stride = 1. /
info.spatial_scale();
48 const T *anchors_ptr = anchors.
data();
49 T *all_anchors_ptr = all_anchors.
data();
53 #pragma omp parallel for schedule(dynamic, 1) collapse(3)
55 for(
int y = 0; y < height; y++)
57 for(
int x = 0; x < width; x++)
59 for(
int a = 0; a < num_anchors; a++)
61 const T shift_x = T(x) * T(stride);
62 const T shift_y = T(y) * T(stride);
63 const size_t anchor_id = a + x * num_anchors + y * width * num_anchors;
65 all_anchors_ptr[anchor_id * 4] = anchors_ptr[4 * a] + shift_x;
67 all_anchors_ptr[anchor_id * 4 + 1] = anchors_ptr[4 * a + 1] + shift_y;
69 all_anchors_ptr[anchor_id * 4 + 2] = anchors_ptr[4 * a + 2] + shift_x;
71 all_anchors_ptr[anchor_id * 4 + 3] = anchors_ptr[4 * a + 3] + shift_y;