@@ -77,13 +77,13 @@ class PriorBoxOpKernel : public framework::OpKernel<T> {
77
77
auto img_width = image->dims ()[3 ];
78
78
auto img_height = image->dims ()[2 ];
79
79
80
- auto layer_width = input->dims ()[3 ];
81
- auto layer_height = input->dims ()[2 ];
80
+ auto feature_width = input->dims ()[3 ];
81
+ auto feature_height = input->dims ()[2 ];
82
82
83
83
T step_width, step_height;
84
84
if (step_w == 0 || step_h == 0 ) {
85
- step_width = static_cast <T>(img_width) / layer_width ;
86
- step_height = static_cast <T>(img_height) / layer_height ;
85
+ step_width = static_cast <T>(img_width) / feature_width ;
86
+ step_height = static_cast <T>(img_height) / feature_height ;
87
87
} else {
88
88
step_width = step_w;
89
89
step_height = step_h;
@@ -98,8 +98,8 @@ class PriorBoxOpKernel : public framework::OpKernel<T> {
98
98
vars->mutable_data <T>(ctx.GetPlace ());
99
99
100
100
auto e_boxes = framework::EigenTensor<T, 4 >::From (*boxes);
101
- for (int h = 0 ; h < layer_height ; ++h) {
102
- for (int w = 0 ; w < layer_width ; ++w) {
101
+ for (int h = 0 ; h < feature_height ; ++h) {
102
+ for (int w = 0 ; w < feature_width ; ++w) {
103
103
T center_x = (w + offset) * step_width;
104
104
T center_y = (h + offset) * step_height;
105
105
T box_width, box_height;
@@ -164,12 +164,16 @@ class PriorBoxOpKernel : public framework::OpKernel<T> {
164
164
boxes->data <T>(), clip_func);
165
165
}
166
166
167
- Eigen::Tensor<T, 2 , Eigen::RowMajor> var_et (1 , variances.size ());
167
+ framework::Tensor var_t ;
168
+ var_t .mutable_data <T>(
169
+ framework::make_ddim ({1 , static_cast <int >(variances.size ())}),
170
+ ctx.GetPlace ());
171
+ auto var_et = framework::EigenTensor<T, 2 >::From (var_t );
168
172
for (size_t i = 0 ; i < variances.size (); ++i) {
169
173
var_et (0 , i) = variances[i];
170
174
}
171
175
172
- int box_num = layer_height * layer_width * num_priors;
176
+ int box_num = feature_height * feature_width * num_priors;
173
177
auto var_dim = vars->dims ();
174
178
vars->Resize ({box_num, static_cast <int >(variances.size ())});
175
179
0 commit comments