def perform(self, node, ins, outs):
        x, = ins
        outs[0][0] = z = x.copy()
        B,M,N,K = x.shape
        for level in range(1,self.n_levels):
            # z is the whole pyramid at level `level-1`
            # loop body builds `out` which is the pyramid at `level`
            z0 = z[0]
            if z0.shape[0] <=2 or z0.shape[1] <= 2:
                raise ValueError('Cannot downsample an image smaller than 3x3',
                        z0.shape)
            logger.info('{0} {1} {2}'.format(z0.shape, z0.dtype, z0.strides))
            out0 = cv.pyrDown(z0)
            assert out0.dtype == x.dtype
            if out0.ndim ==3:
                assert out0.shape[2] == x.shape[3] # assert same # channels
            else:
                assert K==1
            out = numpy.empty(
                    (x.shape[0],
                        out0.shape[0],
                        out0.shape[1],
                        K),
                    dtype=out0.dtype)
            if K==1:
                out[0][:,:,0] = out0
            else:
                out[0] = out0
            for i, zi in enumerate(z[1:]):
                if K==1:
                    out[i][:,:,0] = cv.pyrDown(z[i])
                else:
                    out[i] = cv.pyrDown(z[i])
            outs[level][0] = out
            z = out


# test infer shape

# test non power-of-two shapes

# test different numbers of channels
Stop the plugin.
dataset/ETHPy150Open lisa-lab/pylearn2/pylearn2/packaged_dependencies/theano_linear/pyramid.py/GaussianPyramid.perform--crossover with--dataset/ETHPy150Open enthought/envisage/envisage/tests/plugins/pear/pear_plugin.py/PearPlugin.stop