def init(self, params, autotune=0, filter_extern=0):

        R, S = 3,3
        N, C, K, H, W, P, Q, pad_h, pad_w, relu, bsum = self.params

        if not autotune:
            if N >= 32:
                if self.dtype.type is np.float32:
                    filter_extern = 512 < C and K < 512
                else:
                    filter_extern = True
                self.initialized = True
            else:
                autotune_db = shelve.open(self.autotune_db_file)

                if self.autotune_key in autotune_db:
                    filter_extern = autotune_db[self.autotune_key]
                    self.initialized = True
                else:
                    filter_extern    = True
                    self.initialized = False

                autotune_db.close()

            #print filter_extern, self.autotune_key

        filter_trans = "_FX" if filter_extern else ""

        kernel_name = "%s_winograd_2x2_3x3_32x32%s" % (self.clss, filter_trans)

        if N == 1:
            shiftN = 0
        elif N < 32:
            shiftN = len(bin(N-1))-2
        else:
            shiftN = 5
        blkN = 1 << shiftN

        shiftY, shiftX, superY, superX = {
            1 : (3,4,0x203,0x300), # 4x8
            2 : (3,3,0x203,0x201), # 4x4
            4 : (2,3,0x104,0x202), # 2x4
            8 : (2,2,0x104,0x103), # 2x2
            16: (1,2,0x000,0x104), # 1x2
            32: (1,1,0x000,0x000), # 1x1
        }.get(blkN)

        #print "%d, 0x%03x, 0x%03x" % (blkN, superY, superX)

        gridK = _ceil_div(K, 32)
        gridY = _ceil_div(P, 1<<shiftY)
        gridX = _ceil_div(Q, 1<<shiftX)
        gridN = _ceil_div(N, blkN)
        Y2    = gridY // 2
        X2    = gridX  * 2
        XNp   = W*N   * self.dtype.itemsize
        YXNp  = H*W*N * self.dtype.itemsize
        SKp   = S*K   * self.dtype.itemsize
        RSKp  = R*S*K * self.dtype.itemsize
        C4Kp  = gridK * self.dtype.itemsize * 4 * 512

        # process not more than 4 groups of K32 tiles at a time
        # perhaps tune this for smaller cache sizes
        groupK = _closest_divisor(gridK, 4)
        YXGK   = gridY*gridX*groupK
        X2GK   = X2*groupK

        magic_YXGK   = _magic64(YXGK)
        magic_X2GK   = _magic64(X2GK)
        magic_groupK = _magic32(X2GK, groupK)

        grid  = ( gridK*gridY*gridX, gridN, 1 )
        block = (256, 1, 1)

        self.kernel = [ kernel_name, grid, block, None, None, None, None, None, None, None, None ]
        self.kernel.extend( _flatten([
            K, C, H, W, N, P, Q, W*N, H*W*N, R*S*K, Q*N, P*Q*N,
            shiftY, shiftX, shiftN, superY, superX, gridX, gridK, Y2,
            YXGK, X2GK, groupK, magic_YXGK, magic_X2GK, magic_groupK,
            2*XNp, XNp, 4*YXNp-3*XNp, 2*SKp, SKp, 4*RSKp-SKp, C4Kp, pad_h, pad_w ]))

        self.flags  = (relu and 2) + (bsum and 4)

        return filter_extern
dataset/ETHPy150Open NervanaSystems/neon/neon/backends/winograd_conv.py/XpropWinograd.init/swapped operands of `<`