     const int blockPxY = 4*(blockIdx.y / numFilterBlocks);
     const int blockImgIdx = (blockIdx.x % numImgBlocks) * B_X * imgsPerThread;
     const int blockFilterIdx = (blockIdx.y % numFilterBlocks) * filtersPerThread;
-
+    
     const int tidx = threadIdx.y * B_X + threadIdx.x;
     const int loadY = tidx / 32, loadX = tidx % 32;
-
+    
     const int startPxX = MAX(0, -DIVUP(sizeX,2) + blockPxX + 1);
     const int startPxY = MAX(0, -DIVUP(sizeX,2) + blockPxY + 1);
     const int endPxX = MIN(imgSize, blockPxX + sizeX/2 + 4);

    meanDiffs += (blockFilterIdx + threadIdx.y) * imgPixels * numImages + imgIdx;
    denoms += ((blockFilterIdx + threadIdx.y) * imgPixels + pxIdx) * numImages + imgIdx;
    target += ((blockFilterIdx + threadIdx.y) * imgPixels + pxIdx) * numImages + imgIdx;

    float prod[filtersPerThread][imgsPerThread];
    #pragma unroll
    for (int i = 0; i < imgsPerThread; i++) {

    const int outputIdx = outputIdxY * outputsX + outputIdxX;
    const int numOutputs = outputsX * outputsX;
    const int imgPixels = imgSize * imgSize;
    
    const int startImgPxX = startX + outputIdxX * strideX;
    const int startImgPxY = startX + outputIdxY * strideX;
    const int imgIdx = blockImgIdx + threadIdx.x;
    const int imgPx = startImgPxY * imgSize + startImgPxX;
    
    imgs += myChanIdx * imgPixels * numImages + imgPx * numImages + imgIdx;
    target += (myChanIdx * numOutputs + outputIdx) * numImages + imgIdx;
    
    if (scaleTargets != 0) {
        if (!reverse) {
            #pragma unroll
