wkcn commented on a change in pull request #16292: [Done] BilinearResize2D 
optimized
URL: https://github.com/apache/incubator-mxnet/pull/16292#discussion_r334214665
 
 

 ##########
 File path: src/operator/contrib/bilinear_resize.cc
 ##########
 @@ -69,23 +70,25 @@ void 
SpatialUpSamplingBilinearUpdateOutput(mshadow::Stream<cpu> *s,
     }
     return;
   }
+  const DType rheight = area_pixel_compute_scale<DType>(
+    inputHeight, outputHeight, align_corners);
+  const DType rwidth = area_pixel_compute_scale<DType>(
+    inputWidth, outputWidth, align_corners);
 
-  const float rheight =(outputHeight > 1) ? static_cast<float>(inputHeight - 
1)/
-                       (outputHeight - 1) : 0.f;
-  const float rwidth = (outputWidth > 1) ? static_cast<float>(inputWidth - 1) /
-                       (outputWidth - 1) : 0.f;
 #pragma omp parallel for num_threads(nthreads)
   for (int index = 0; index < output_elems_per_channel; index++) {
     const int h2 = index / outputWidth;
     const int w2 = index % outputWidth;
 
-    const float h1r = rheight * h2;
+  const DType h1r = area_pixel_compute_source_index<DType>(
 
 Review comment:
   const float h1r. same as above.

----------------------------------------------------------------
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