def conv2d(self, img, kern, mode="valid"):
        """
        Basic slow python implementatation for DebugMode
        """

        if not imported_scipy_signal:
            raise NotImplementedError(
                "AbstractConv perform requires the python package"
                " for scipy.signal to be installed.")
        if not (mode in ('valid', 'full')):
            raise ValueError(
                'invalid mode {}, which must be either '
                '"valid" or "full"'.format(mode))

        out_shape = get_conv_output_shape(img.shape, kern.shape, mode, [1, 1])
        out = numpy.zeros(out_shape, dtype=img.dtype)
        val = _valfrommode(mode)
        bval = _bvalfromboundary('fill')
        for b in xrange(img.shape[0]):
            for n in xrange(kern.shape[0]):
                for im0 in xrange(img.shape[1]):
                    out[b, n, ...] += _convolve2d(img[b, im0, ...],
                                                  kern[n, im0, ...],
                                                  1, val, bval, 0)
        return out
dataset/ETHPy150Open rizar/attention-lvcsr/libs/Theano/theano/tensor/nnet/abstract_conv.py/BaseAbstractConv2d.conv2d/original