def _k_decl(self, node, nodename, pattern=None,
                ndim=None, reduce_mask=None):
        if reduce_mask is None:
            reduce_mask = self.reduce_mask
        if ndim is None:
            ndim = len(reduce_mask)
        if pattern is None:
            pattern = ''.join(str(i) for i in reduce_mask)
        sio = StringIO()

        print("""
            static __global__ void kernel_reduce_%(pattern)s_%(nodename)s(
        """ % locals(), file=sio)
        for i in xrange(ndim):
            print("""
                    const int d%(i)s,
        """ % locals(), file=sio)
        print("""
                    const float *A,
        """ % locals(), file=sio)
        for i in xrange(ndim):
            print("""
                    const int sA%(i)s,
        """ % locals(), file=sio)
        print("""
                    float * Z
        """ % locals(), file=sio)
        for i in xrange(ndim - sum(reduce_mask)):
            print("""
                    , const int sZ%(i)s
        """ % locals(), file=sio)
        print(")", file=sio)
        return sio.getvalue()
Return a string to declare a kernel function.
dataset/ETHPy150Open rizar/attention-lvcsr/libs/Theano/theano/sandbox/cuda/basic_ops.py/GpuCAReduce._k_decl