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 _label_generator(self):
      def normalize(label):
          label = tf.one_hot(label, 10)
          return label
  
      def shaping(label):
          label = tf.reshape(
              label, shape=[self.batch_size, self.num_classes]
          )
          return label
  
      dataset = tf.data.TFRecordDataset([self.file_name])
      dataset = (
          dataset.map(decode_label)
          .map(normalize)
          .cache()
          .shuffle(self.num_samples, seed=11111)
          .batch(self.batch_size, drop_remainder=True)
          .map(shaping)
      )  # drop remainder because we need to fix batch size in private model
      if self.train:
          dataset = dataset.repeat()
      dataset = dataset.prefetch(tf.data.experimental.AUTOTUNE)
      label_iter = iter(dataset)
  
      return label_iter
  
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 7 for calling the MnistDataset obj's underlying member method code with example usage: obj._label_generator() and returns: label_iter, label, label