   long nOutputCols = ceil(float(nInputCols - kW) / float(dW)) + 1;
   long nOutputRows = ceil(float(nInputRows - kH) / float(dH)) + 1;
 
+  input = THCudaTensor_newContiguous(state, input);
+  gradOutput = THCudaTensor_newContiguous(state, gradOutput);
   THCudaTensor_resizeAs(state, gradInput, input);
   
   int count = THCudaTensor_nElement(state, input);

      batchSize, nInputPlane, nInputRows, nInputCols, nOutputRows, nOutputCols,
      kH, kW, dH, dW,
      THCudaTensor_data(state, gradInput));
}


  if(input->nDimension == 3)
    THCudaTensor_resize3d(state, output, nInputPlane, nOutputRows, nOutputCols);
  THCudaTensor_free(state, input);
}


