def image_transform(self, N, C, K, H, W, P, Q, pad_h, pad_w):

        if N == 1:
            shlN = 0
        elif N < 16:
            shlN = len(bin(1-N))-2
        else:
            shlN = 4

        GY = _ceil_div(P, 2)
        GX = _ceil_div(Q, 2)

        # maximize points of GX in superblock for large GX (most contiguous access)
        if shlN > 1 or GX >= 32:
            shlY, shlX, maskY, shrY, maskX, shrX, maskN = {
                0 : (1, 5, 0x0, 0, 0xf, 0, 0x0), # 1x16 xxxx
                1 : (1, 4, 0x0, 0, 0xe, 1, 0x1), # 1x8  xxxn
                2 : (1, 3, 0x0, 0, 0xc, 2, 0x3), # 1x4  xxnn
                3 : (1, 2, 0x0, 0, 0x8, 3, 0x7), # 1x2  xnnn
                4 : (1, 1, 0x0, 0, 0x0, 0, 0xf), # 1x1  nnnn
            }.get(shlN)
        # Only use GY in superblock for small N
        elif shlN > 0 or GX >= 16:
            shlY, shlX, maskY, shrY, maskX, shrX, maskN = {
                0 : (2, 4, 0x8, 3, 0x7, 0, 0x0), # 2x8  yxxx
                1 : (2, 3, 0x8, 3, 0x6, 1, 0x1), # 2x4  yxxn
            }.get(shlN)
        # if GX is small use more points of GY in superblock
        else:
            shlY, shlX, maskY, shrY, maskX, shrX, maskN = {
                0 : (3, 3, 0xc, 2, 0x3, 0, 0x0), # 4x4  yyxx
            }.get(shlN)

        blkN = 1 << shlN
        blkY = 1 << shlY
        blkX = 1 << shlX

        gridC  = _ceil_div(C, 32)

        GC  = _ceil_div(gridC*32, 16)
        GYS = _ceil_div(P, blkY)
        GXS = _ceil_div(Q, blkX)
        GN  = _ceil_div(N, blkN)
        GYS2 = GYS // 2
        GXS2 = GXS  * 2

        # Since our shared memory shuffle block is 16x16, try to process
        # C and N in blocks of 2.  This gives the same performance as a 32x32 block.
        groupC  = 2 # GC always divisible by 2
        groupN  = 1 if GN & 1 else 2
        shift_c = groupC - 1
        shift_n = groupN - 1

        X2cn       = GXS2 * groupC * groupN
        magic_X2cn = _magic64(X2cn)

        self.trans_size = gridC * GY * GX * N * 512 * self.dtype.itemsize
        self.trans_args = [(GYS*GXS*groupC*groupN, GN//groupN, GC//groupC),
                           (256,1,1), None, None, None,
                            C, H, W, N, pad_h, pad_w,
                            GY, GX, GXS, GYS2, X2cn,
                            magic_X2cn[0], magic_X2cn[1], shift_c, shift_n,
                            shlY, shlX, maskY, shrY, maskX, shrX, shlN, maskN,
                            H*W*N, W*N, GY*GX*N*512, GX*N*512, N*512 ]
dataset/ETHPy150Open NervanaSystems/neon/neon/backends/winograd_conv.py/UpdateWinograd.image_transform/swapped operands of `-`