You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2017/11/02 06:48:58 UTC

[GitHub] conansherry commented on issue #8504: is there a bug in roi_pooling.cu?

conansherry commented on issue #8504: is there a bug in roi_pooling.cu?
URL: https://github.com/apache/incubator-mxnet/issues/8504#issuecomment-341332446
 
 
   ```
   template<typename Dtype>
   inline void ROIPoolForward(const Tensor<gpu, 4, Dtype> &out,
                              const Tensor<gpu, 4, Dtype> &data,
                              const Tensor<gpu, 2, Dtype> &bbox,
                              const Tensor<gpu, 4, Dtype> &max_idx,
                              const float spatial_scale) {
     const Dtype *bottom_data = data.dptr_;
     const Dtype *bottom_rois = bbox.dptr_;
     Dtype *top_data = out.dptr_;
     Dtype *argmax_data = max_idx.dptr_;
     const int count = out.shape_.Size();
     const int channels = data.size(1);
     const int height = data.size(2);
     const int width = data.size(3);
     const int pooled_height = out.size(2);
     const int pooled_width = out.size(3);
     const int gridSize = (count + kMaxThreadsPerBlock - 1) / kMaxThreadsPerBlock;
     dim3 dimGrid(kMaxGridDim, (gridSize + kMaxGridDim - 1) / kMaxGridDim);
     dim3 dimBlock(kMaxThreadsPerBlock);
     CheckLaunchParam(dimGrid, dimBlock, "ROIPooling Forward");
     cudaStream_t stream = Stream<gpu>::GetStream(out.stream_);
     ROIPoolForwardKernel<Dtype><<<dimGrid, dimBlock, 0, stream>>>(
         count, bottom_data, spatial_scale, channels, height, width,
         pooled_height, pooled_width, bottom_rois, top_data, argmax_data);
   }
   ```
   ```
   blockDim.x * gridDim.x * gridDim.y = kMaxThreadsPerBlock * (kMaxGridDim * (gridSize + kMaxGridDim - 1) / kMaxGridDim) = kMaxThreadsPerBlock * (gridSize + kMaxGridDim - 1) = kMaxThreadsPerBlock * ( (count + kMaxThreadsPerBlock - 1) / kMaxThreadsPerBlock + kMaxGridDim - 1) = count + kMaxThreadsPerBlock - 1 + kMaxThreadsPerBlock * (kMaxGridDim - 1) > count. 
   ```
   so it will no problem. = =

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


With regards,
Apache Git Services