code: def _dataset_creator():
      """Returns an unbatched dataset."""
  
      def _parser_fn(serialized_example):
          """Parses a single tf.Example into image and label tensors."""
          features = {}
          features["image/ct_image"] = tf.FixedLenFeature([], tf.string)
          features["image/label"] = tf.FixedLenFeature([], tf.string)
          parsed = tf.parse_single_example(
              serialized_example, features=features
          )
  
          image = tf.decode_raw(parsed["image/ct_image"], tf.float32)
          label = tf.decode_raw(parsed["image/label"], tf.float32)
  
          # Preprocess color, clip to 0 ~ 1.
          image = tf.clip_by_value(image / 1024.0 + 0.5, 0, 1)
  
          spatial_dims = [FLAGS.ct_resolution] * 3
          image = tf.reshape(image, spatial_dims)
          label = tf.reshape(label, spatial_dims)
  
          (
              image,
              label,
          ) = data_aug_lib.maybe_gen_fake_data_based_on_real_data(
              image,
              label,
              FLAGS.ct_resolution,
              FLAGS.min_fake_lesion_ratio,
              FLAGS.gen_fake_probability,
          )
  
          return image, label
  
      dataset = tf.data.Dataset.list_files(
          FLAGS.input_file_pattern, shuffle=True
      ).repeat()
      dataset = dataset.apply(
          functools.partial(
              tf.data.TFRecordDataset, compression_type="GZIP"
          )
      )
      dataset = dataset.shuffle(2).map(_parser_fn, num_parallel_calls=2)
  
      return dataset
  
file_path: mesh/mesh_tensorflow/experimental/offline_data_aug.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import functools
  import os
  from absl import app
  from absl import flags
  from six.moves import range
  import tensorflow.compat.v1
  from mesh_tensorflow.experimental import data_aug_lib
label_desc: Use image node_id 1 for calling a global function with example usage: _dataset_creator() and returns: dataset, image,  label