def __init__(self, train_or_test, shuffle=None, dir=None, cifar_classnum=10):
        """
        Args:
            train_or_test (str): 'train' or 'test'
            shuffle (bool): defaults to True for training set.
            dir (str): path to the dataset directory
            cifar_classnum (int): 10 or 100
        """
        assert train_or_test in ['train', 'test']
        assert cifar_classnum == 10 or cifar_classnum == 100
        self.cifar_classnum = cifar_classnum
        if dir is None:
            dir = get_dataset_path('cifar{}_data'.format(cifar_classnum))
        maybe_download_and_extract(dir, self.cifar_classnum)
        train_files, test_files, meta_file = get_filenames(dir, cifar_classnum)
        if train_or_test == 'train':
            self.fs = train_files
        else:
            self.fs = test_files
        for f in self.fs:
            if not os.path.isfile(f):
                raise ValueError('Failed to find file: ' + f)
        self._label_names = _parse_meta(meta_file, cifar_classnum)
        self.train_or_test = train_or_test
        self.data = read_cifar(self.fs, cifar_classnum)
        self.dir = dir

        if shuffle is None:
            shuffle = train_or_test == 'train'
        self.shuffle = shuffle

        Args:
            train_or_test (str): 'train' or 'test'
            shuffle (bool): defaults to True for training set.
            dir (str): path to the dataset directory
            cifar_classnum (int): 10 or 100
        
tensorpack/dataflow/dataset/cifar.py