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 2019/02/13 00:08:11 UTC

[GitHub] sandeep-krishnamurthy commented on a change in pull request #14139: Performance improvement in Normalize GPU Kernel

sandeep-krishnamurthy commented on a change in pull request #14139: Performance improvement in Normalize GPU Kernel
URL: https://github.com/apache/incubator-mxnet/pull/14139#discussion_r256200078
 
 

 ##########
 File path: src/operator/image/image_random.cu
 ##########
 @@ -111,6 +110,232 @@ void ToTensorImplCUDA(mshadow::Stream<gpu> *s,
         MSHADOW_CUDA_POST_KERNEL_CHECK(ToTensorCudaKernel);
 }
 
+// Normalize Kernel for 3D input
+template<typename xpu, typename DType>
+__global__ void NormalizeCudaKernel(const Tensor<xpu, 3, DType> input,
+                                    const Tensor<xpu, 3, DType> output,
+                                    const int req,
+                                    const int N,
+                                    const int H,
+                                    const int W,
+                                    const int C,
+                                    const float mean_d0,
+                                    const float mean_d1,
+                                    const float mean_d2,
+                                    const float std_d0,
+                                    const float std_d1,
+                                    const float std_d2) {
+    // We process one image per thread block.
+    // In 3D case, we have only 1 block i.e., blockIdx.x
+    // We do not use it.
+
+    float mean = mean_d0;
 
 Review comment:
   I agree, I am not totally to it, but compared to if..else or cuda mem alloc / copy and pass an vector, I had to choose this route for performance and readability.

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