pengzhao-intel commented on a change in pull request #16017: Add RROIAlign
URL: https://github.com/apache/incubator-mxnet/pull/16017#discussion_r317919578
 
 

 ##########
 File path: src/operator/rroi_align.cc
 ##########
 @@ -0,0 +1,313 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/*!
+ * Copyright (c) 2015 by Contributors
+ * \file rroi_align.cc
+ * \brief rroi align operator
+ * \author Yixin Bao
+ * Adapted from Caffe2
+*/
+#include "./rroi_align-inl.h"
+#include <mshadow/tensor.h>
+#include "math.h"
+
+using std::max;
+using std::min;
+using std::floor;
+using std::ceil;
+
+namespace mxnet {
+namespace op {
+
+template <typename DType>
+struct position_for_bilinear_interpolate {
+  // 4 positions and corresponding weights for
+  // computing bilinear interpolation
+  int pos1, pos2, pos3, pos4;
+  DType w1, w2, w3, w4;
+};
+
+template <typename DType>
+void pre_calc_for_bilinear_interpolate(
+    const int height, const int width, const int pooled_height, const int 
pooled_width,
+    const int iy_upper, const int ix_upper, DType roi_start_h, DType 
roi_start_w,
+    DType bin_size_h, DType bin_size_w, int roi_bin_grid_h, int roi_bin_grid_w,
+    DType roi_center_h, DType roi_center_w, DType theta,
+    std::vector<position_for_bilinear_interpolate<DType>> *pre_calc) {
+  int pre_calc_index = 0;
+  DType cosTheta = cos(theta);
+  DType sinTheta = sin(theta);
+  for (int ph = 0; ph < pooled_height; ph++) {
 
 Review comment:
   Add parallelization for the loop?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to