   dim4 tgt_stride(0);
   dim4 size(1);
 
-  uint ndim = THCudaTensor_nDimension(src);
-  for(uint dim=0; dim < ndim; dim++) {
-    uint odim = ndim - 1 - dim;
+  unsigned ndim = THCudaTensor_nDimension(src);
+  for(unsigned dim=0; dim < ndim; dim++) {
+    unsigned odim = ndim - 1 - dim;
     src_stride[odim] = THCudaTensor_stride(src, dim);
     tgt_stride[odim] = THCudaTensor_stride(tgt, dim);
     size[odim]       = THCudaTensor_size(src, dim);
   }
 
   dim3 threads(32, 16);
-  uint nBlockPerRow = (size[1] + threads.y - 1) / threads.y;
+  unsigned nBlockPerRow = (size[1] + threads.y - 1) / threads.y;
   dim3 grid(size[2], nBlockPerRow, size[3]);
 
   THCudaTensor_kernel_reduceInnermostDim<<<grid, threads>>>(THCudaTensor_data(tgt),

  }

  if(reducing) {
    uint row = blockIdx.y * blockDim.y + threadIdx.x;
    uint tgt_offset = blockIdx.z * tgt_stride[3] + blockIdx.x * tgt_stride[2];
    tgt[tgt_offset + row] = float(acc);
  }
}

        dim4 src_stride, dim4 tgt_stride, dim4 size, Op op, T init)
{
  const size_t reduce = 3;
  unsigned col = blockIdx.x * blockDim.x + threadIdx.x;
  float *src = src_ + blockIdx.z * src_stride[2] + blockIdx.y * src_stride[1] + col;

  if(col < size[0]) {
    T acc = init;
    for(unsigned i=0; i < size[reduce]; i++) {
      acc = op((T) acc, (T) *src);
      src += src_stride[reduce];
    }
