[IE CLDNN] Fix padding in reduce fsv16 kernel (#2787)
authorMikołaj Życzyński <mikolaj.zyczynski@intel.com>
Fri, 23 Oct 2020 07:16:21 +0000 (09:16 +0200)
committerGitHub <noreply@github.com>
Fri, 23 Oct 2020 07:16:21 +0000 (10:16 +0300)
inference-engine/thirdparty/clDNN/kernel_selector/core/cl_kernels/reduce_gpu_b_fs_yx_fsv16.cl

index 1d5f859..52a8388 100644 (file)
@@ -203,6 +203,7 @@ KERNEL(reduce_fsv16)(
     const uint input_y_pitch = input_x_pitch * (INPUT0_PAD_BEFORE_SIZE_X + INPUT0_SIZE_X + INPUT0_PAD_AFTER_SIZE_X);
     const uint input_fs_pitch = input_y_pitch * (INPUT0_PAD_BEFORE_SIZE_Y + INPUT0_SIZE_Y + INPUT0_PAD_AFTER_SIZE_Y);
     const uint input_batch_pitch = input_fs_pitch * ((INPUT0_PAD_BEFORE_FEATURE_NUM + INPUT0_FEATURE_NUM + INPUT0_PAD_AFTER_FEATURE_NUM + FSV - 1) / FSV);
+    const uint padding_pitch = INPUT0_GET_INDEX(0, 0, 0, 0);
 
     const uint output_x_pitch = FSV;
     const uint output_y_pitch = FSV * (OUTPUT_PAD_BEFORE_SIZE_X + OUTPUT_SIZE_X + OUTPUT_PAD_AFTER_SIZE_X);
@@ -243,7 +244,7 @@ KERNEL(reduce_fsv16)(
     const uint x_leftover_end = x_max_val;
 #endif
 
-uint offset = batch_out * input_batch_pitch + ((feature_out + FSV - 1) / FSV) * input_fs_pitch + y_out * input_y_pitch + x_out * input_x_pitch;
+uint offset = batch_out * input_batch_pitch + ((feature_out + FSV - 1) / FSV) * input_fs_pitch + y_out * input_y_pitch + x_out * input_x_pitch + padding_pitch;
 
 #if REDUCE_X
     ACCUMULATOR_TYPE acc = INIT_VAL;