code: def input_fn(
      is_training,
      data_dir,
      batch_size,
      eval_image_size,
      normalize=0,
      num_epochs=1,
      dtype=tf.float32,
      datasets_num_private_threads=None,
      num_parallel_batches=1,
      parse_record_fn=parse_record,
  ):
      """Input function which provides batches for train or eval.
  
      Args:
        is_training: A boolean denoting whether the input is for training.
        batch_size: The number of samples per batch.
        num_epochs: The number of epochs to repeat the dataset.
        dtype: Data type to use for images/features
        datasets_num_private_threads: Number of private threads for tf.data.
        num_parallel_batches: Number of parallel batches for tf.data.
        parse_record_fn: Function to use for parsing the records.
  
      Returns:
        A dataset that can be used for iteration.
      """
      if is_training:
          filenames = [
              os.path.join(data_dir, "train-%05d-of-01024" % i)
              for i in range(1024)
          ]
      else:
          filenames = [
              os.path.join(data_dir, "validation-%05d-of-00128" % i)
              for i in range(128)
          ]
  
      dataset = tf.data.Dataset.from_tensor_slices(filenames)
  
      if is_training:
          # Shuffle the input files
          dataset = dataset.shuffle(buffer_size=_NUM_TRAIN_FILES)
  
      # Convert to individual records.
      # cycle_length = 10 means 10 files will be read and deserialized in parallel.
      # This number is low enough to not cause too much contention on small systems
      # but high enough to provide the benefits of parallelization. You may want
      # to increase this number if you have a large number of CPU cores.
      dataset = dataset.interleave(
          tf.data.TFRecordDataset,
          cycle_length=48,
          num_parallel_calls=tf.data.experimental.AUTOTUNE,
      )
  
      return process_record_dataset(
          dataset=dataset,
          is_training=is_training,
          batch_size=batch_size,
          eval_image_size=eval_image_size,
          normalize=normalize,
          parse_record_fn=parse_record_fn,
          num_epochs=num_epochs,
          dtype=dtype,
          datasets_num_private_threads=datasets_num_private_threads,
          num_parallel_batches=num_parallel_batches,
      )
  
file_path: tensornets/examples/imagenet_preprocessing.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import os
  import tensorflow
label_desc: Use image node_id 11 for calling a global function with example usage: input_fn(is_training, data_dir, batch_size, eval_image_size, normalize, num_epochs, dtype, datasets_num_private_threads, num_parallel_batches, parse_record_fn) and returns: process_record_dataset