code: def make_input_fn(
      file_pattern, batch_size, randomize_input=True, num_epochs=None
  ):
      """Returns `Estimator` `input_fn` for TRAIN and EVAL.
  
      Args:
        file_pattern: (string) file pattern for the TFRecord input data.
        batch_size: (int) number of input examples to process per batch.
        randomize_input: (bool) if true, randomize input example order. It should
          almost always be true except for unittest/debug purposes.
        num_epochs: (int) Number of times the input dataset must be repeated. None
          to repeat the data indefinitely.
  
      Returns:
        An `input_fn` for `Estimator`.
      """
      tf.compat.v1.logging.info(
          "FLAGS.data_format={}".format(FLAGS.data_format)
      )
  
      def _input_fn():
          """Defines the input_fn."""
          context_feature_spec = (
              tf.feature_column.make_parse_example_spec(
                  context_feature_columns().values()
              )
          )
          label_column = tf.feature_column.numeric_column(
              _LABEL_FEATURE,
              dtype=tf.int64,
              default_value=_PADDING_LABEL,
          )
          example_feature_spec = (
              tf.feature_column.make_parse_example_spec(
                  list(example_feature_columns().values())
                  + [label_column]
              )
          )
          dataset = tfr.data.build_ranking_dataset(
              file_pattern=file_pattern,
              data_format=FLAGS.data_format,
              batch_size=batch_size,
              list_size=FLAGS.list_size,
              context_feature_spec=context_feature_spec,
              example_feature_spec=example_feature_spec,
              reader=tf.data.TFRecordDataset,
              shuffle=randomize_input,
              num_epochs=num_epochs,
              mask_feature_name=_MASK,
          )
          features = tf.compat.v1.data.make_one_shot_iterator(
              dataset
          ).get_next()
          label = tf.squeeze(features.pop(_LABEL_FEATURE), axis=2)
          label = tf.cast(label, tf.float32)
  
          return features, label
  
      return _input_fn
  
file_path: ranking/tensorflow_ranking/examples/tf_ranking_tfrecord.py
imports: from absl import flags
  import tensorflow
  from tensorflow import estimator
  import tensorflow_ranking
label_desc: Use image node_id 3 for calling a global function with example usage: make_input_fn(file_pattern, batch_size, randomize_input, num_epochs) and returns: _input_fn, features,  label