code: def read_cifar(filenames, cifar_classnum):
      assert cifar_classnum == 10 or cifar_classnum == 100
      ret = []
      for fname in filenames:
          fo = open(fname, "rb")
          dic = pickle.load(fo, encoding="bytes")
          data = dic[b"data"]
          if cifar_classnum == 10:
              label = dic[b"labels"]
              IMG_NUM = (
                  10000  # cifar10 data are split into blocks of 10000
              )
          else:
              label = dic[b"fine_labels"]
              IMG_NUM = 50000 if "train" in fname else 10000
          fo.close()
          for k in range(IMG_NUM):
              img = data[k].reshape(3, 32, 32)
              img = np.transpose(img, [1, 2, 0])
              ret.append([img, label[k]])
      return ret
  
imports: import numpy
  import os
  import pickle
  import tarfile
  from ...utils import logger
  from ...utils.fs import download, get_dataset_path
  from ..base import RNGDataFlow
label_desc: Use image node_id 2 for calling a global function with example usage: read_cifar(filenames, cifar_classnum) and returns: ret