

def setUp(self):
    numpy.random.seed(((9 + 5) + 2015))
    self.train_features_mock = [numpy.random.randint(0, 256, (10, 3, 32, 32)).astype('uint8') for i in range(5)]
    self.train_targets_mock = [numpy.random.randint(0, 10, (10,)).astype('uint8') for i in range(5)]
    self.test_features_mock = numpy.random.randint(0, 256, (10, 3, 32, 32)).astype('uint8')
    self.test_targets_mock = numpy.random.randint(0, 10, (10,)).astype('uint8')
    self.tempdir = tempfile.mkdtemp()
    with remember_cwd():
        os.chdir(self.tempdir)
        os.mkdir('cifar-10-batches-py')
        for (i, (x, y)) in enumerate(zip(self.train_features_mock, self.train_targets_mock)):
            filename = os.path.join('cifar-10-batches-py', 'data_batch_{}'.format((i + 1)))
            with open(filename, 'wb') as f:
                cPickle.dump({
                    'data': x,
                    'labels': y,
                }, f)
        filename = os.path.join('cifar-10-batches-py', 'test_batch')
        with open(filename, 'wb') as f:
            cPickle.dump({
                'data': self.test_features_mock,
                'labels': self.test_targets_mock,
            }, f)
        with tarfile.open('cifar-10-python.tar.gz', 'w:gz') as tar_file:
            tar_file.add('cifar-10-batches-py')

dataset/ETHPy150Open mila-udem/fuel/tests/test_converters.py TestCIFAR10.setUp/original