def downsample(self, imgs_in, scale):
        """
        Downsample an image by a factor of 2**scale
        """
        imgs = imgs_in.copy()

        if scale == 0:
            return imgs

        # if self.downsample_method == 'maxout':
        #     print "maxout",
        #     imgs_maxout = downsample.max_pool_2d(imgs.copy(), (2**scale, 2**scale), ignore_border=False)
        # else:
        #     print "meanout",
        #     imgs_maxout = self.downsample_mean_pool_2d(imgs.copy(), (2**scale, 2**scale))

        num_imgs = imgs.shape[0].astype('int16')
        num_layers = imgs.shape[1].astype('int16')
        nlx0 = imgs.shape[2].astype('int16')
        nlx1 = imgs.shape[3].astype('int16')

        scalepow = np.int16(2**scale)

        # downsample
        imgs = imgs.reshape((num_imgs, num_layers, nlx0/scalepow, scalepow, nlx1/scalepow, scalepow))
        imgs = T.mean(imgs, axis=5)
        imgs = T.mean(imgs, axis=3)
        return imgs
dataset/ETHPy150Open Sohl-Dickstein/Diffusion-Probabilistic-Models/regression.py/MultiScaleConvolution.downsample/original