class_docstr: Abstract class for cifar readers
class_docstr_tok: ["Abstract","class","for","cifar","readers"]
code: def read_cifar(self, filenames):
      if self.n_classes == 10:
          labels_key = b"labels"
      elif self.n_classes == 100:
          labels_key = b"fine_labels"
  
      images_res = []
      labels_res = []
      for fname in filenames:
          with open(fname, "rb") as f:
              images_and_labels = pickle.load(f, encoding="bytes")
          images = images_and_labels[b"data"]
          images = images.reshape(-1, 3, 32, 32)
          images = images.swapaxes(1, 3).swapaxes(1, 2)
          images_res.append(images)
          labels_res.append(images_and_labels[labels_key])
      images_res = np.vstack(images_res)
      labels_res = np.hstack(labels_res)
      if self.one_hot:
          labels_res = self.labels_to_one_hot(labels_res)
      return images_res, labels_res
  
imports: import tempfile
  import os
  import pickle
  import random
  import numpy
  from ..data_providers.base_provider import ImagesDataSet, DataProvider
  from ..data_providers.downloader import download_data_url
label_desc: Use image node_id 7 for calling the CifarDataProvider obj's underlying member method code with example usage: obj.read_cifar(filenames) and returns: images_res,  labels_res