 }
 
 void hl_matrix_vol2Col(real* dataSrc,
-                       int channels, int depth, int height, int width,
-                       int filterD, int filterH, int filterW,
-                       int strideD, int strideH, int strideW,
-                       int paddingD, int paddingH, int paddingW, real* dataDst){
-
+                       int channels,
+                       int depth,
+                       int height,
+                       int width,
+                       int filterD,
+                       int filterH,
+                       int filterW,
+                       int strideD,
+                       int strideH,
+                       int strideW,
+                       int paddingD,
+                       int paddingH,
+                       int paddingW,
+                       real* dataDst) {
   int depth_col = (depth + 2 * paddingD - filterD) / strideD + 1;
   int height_col = (height + 2 * paddingH - filterH) / strideH + 1;
   int width_col = (width + 2 * paddingW - filterW) / strideW + 1;

    int h_in = h_out * strideH - paddingH;
    int d_in = d_out * strideD - paddingD;

    dataDst += ((channel_out * depth_col + d_out) * height_col + h_out) * width_col + w_out;
    dataSrc += ((channel_in * depth + d_in) * height + h_in) * width + w_in;
    for (int k = 0; k < filterD; ++k) {
      for (int i = 0; i < filterH; ++i) {

    int d_col_start = (d < filterD) ? 0 : (d - filterD) / strideD + 1;
    int d_col_end = min(d / strideD + 1, depth_col);

    int offset = (c * filterD * filterW * filterH + d * filterW * filterH +
                  h * filterW + w) *
                 depth_col * height_col * width_col;

    int coeff_d_col =
        (1 - strideD * filterW * filterH * depth_col) * height_col * width_col;
    int coeff_h_col =
        (1 - strideH * filterW * depth_col * height_col) * width_col;
    int coeff_w_col = (1 - strideW * depth_col * height_col * width_col);

    for (int d_col = d_col_start; d_col < d_col_end; ++d_col) {
      for (int h_col = h_col_start; h_col < h_col_end; ++h_col) {
        for (int w_col = w_col_start; w_col < w_col_end; ++w_col) {
          srcVal += dataSrc[offset + d_col * coeff_d_col + h_col * coeff_h_col +
                            w_col * coeff_w_col];
        }
      }
    }
    dataDst[index] = alpha * srcVal + beta * dstVal;
  }
}

void hl_matrix_col2Vol(real* dataDst,
                       int channels,
                       int depth,
                       int height,
                       int width,
                       int filterD,
                       int filterH,
                       int filterW,
                       int strideD,
                       int strideH,
                       int strideW,
                       int paddingD,
                       int paddingH,
                       int paddingW,
                       real* dataSrc,
                       real alpha,
                       real beta) {
  int depth_col = (depth + 2 * paddingD - filterD) / strideD + 1;
  int height_col = (height + 2 * paddingH - filterH) / strideH + 1;
  int width_col = (width + 2 * paddingW - filterW) / strideW + 1;
