class_docstr: Save mnist data into TFRecordDataset and get samples from generator
class_docstr_tok: ["Save","mnist","data","into","TFRecordDataset","and","get","samples","from","generator"]
code: def generator_builder(self, image=True, label=True):
      if not image and not label:
          return None
  
      directory = os.path.join(os.getcwd(), "data")
      if not os.path.exists(directory):
          os.mkdir(directory)
  
      if self.file_name is None:
          self.file_name = os.path.join(directory, "mnist")
          if self.train:
              self.file_name += "_train"
              (x, y), (_, _) = mnist.load_data()
          else:
              self.file_name += "_test"
              (_, _), (x, y) = mnist.load_data()
          if image:
              self.file_name += "_image"
          if label:
              self.file_name += "_label"
          self.file_name += ".tfrecord"
  
      if image:
          if label:
              if not os.path.exists(self.file_name):
                  save_data(x, y, self.file_name)
              return self._data_generator
          else:
              if not os.path.exists(self.file_name):
                  save_image(x, self.file_name)
              return self._image_generator
      else:
          if not os.path.exists(self.file_name):
              save_label(y, self.file_name)
          return self._label_generator
  
imports: import os
  import tensorflow
  from tensorflow.keras.datasets import mnist
  from .convert import decode_data
  from .convert import decode_image
  from .convert import decode_label
  from .convert import save_data
  from .convert import save_image
  from .convert import save_label
label_desc: Use image node_id 8 for calling the MnistDataset obj's underlying member method code with example usage: obj.generator_builder(image, label) and returns: None, self, self, self