@@ -0,0 +1,1321 @@
+import numpy as np%0Aimport unittest%0A%0Afrom chainer import testing%0Afrom chainercv.experimental.links.model.pspnet import convolution_crop%0A%0A%0Aclass TestConvolutionCrop(unittest.TestCase):%0A%0A    def test_convolution_crop(self):%0A        size = (8, 6)%0A        stride = (8, 6)%0A        n_channel = 3%0A        img = np.random.uniform(size=(n_channel, 16, 12)).astype(np.float32)%0A        crop_imgs, param = convolution_crop(%0A            img, size, stride, return_param=True)%0A%0A        self.assertEqual(crop_imgs.shape, (4, n_channel) + size)%0A        self.assertEqual(crop_imgs.dtype, np.float32)%0A        for y in range(2):%0A            for x in range(2):%0A                self.assertEqual(param%5B'y_slices'%5D%5B2 * y + x%5D.start, 8 * y)%0A                self.assertEqual(%0A                    param%5B'y_slices'%5D%5B2 * y + x%5D.stop, 8 * (y + 1))%0A                self.assertEqual(param%5B'x_slices'%5D%5B2 * y + x%5D.start, 6 * x)%0A                self.assertEqual(%0A                    param%5B'x_slices'%5D%5B2 * y + x%5D.stop, 6 * (x + 1))%0A        for i in range(4):%0A            self.assertEqual(param%5B'crop_y_slices'%5D%5Bi%5D.start, 0)%0A            self.assertEqual(param%5B'crop_y_slices'%5D%5Bi%5D.stop, 8)%0A            self.assertEqual(param%5B'crop_x_slices'%5D%5Bi%5D.start, 0)%0A            self.assertEqual(param%5B'crop_x_slices'%5D%5Bi%5D.stop, 6)%0A%0A%0Atesting.run_module(__name__, __file__)%0A

add test_convolution_crop