code: def single_example_input_fn(
      example_proto, input_shape, max_neighbors
  ):
      """Returns an input_fn."""
  
      def make_parse_example_fn(feature_spec):
          """Creates a function parse_example function.
  
          Args:
            feature_spec: A dictionary of features for parsing an input
              tf.train.Example.
  
          Returns:
            A parse_example function.
          """
  
          def parse_example(serialized_example_proto):
              """Extracts relevant fields from the example_proto."""
              return tf.parse_single_example(
                  serialized_example_proto, feature_spec
              )
  
          return parse_example
  
      def input_fn():
          # Construct a tf.data.Dataset from the given Example.
          example = text_format.Parse(example_proto, tf.train.Example())
          serialized_example = example.SerializeToString()
          dataset = tf.data.Dataset.from_tensors(
              tf.convert_to_tensor(serialized_example)
          )
          dataset = dataset.map(
              make_parse_example_fn(
                  make_feature_spec(input_shape, max_neighbors)
              )
          )
          dataset = dataset.batch(1)
          iterator = dataset.make_one_shot_iterator()
          batch_features = iterator.get_next()
          return batch_features, batch_features.pop(LABEL_NAME)
  
      return input_fn
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import os
  import shutil
  import tempfile
  import neural_structured_learning.configs
  import neural_structured_learning.estimator
  import numpy
  import tensorflow
  from tensorflow import estimator
  from google.protobuf import text_format
  from tensorflow.python.framework import test_util
label_desc: Use image node_id 2 for calling a global function with example usage: single_example_input_fn(example_proto, input_shape, max_neighbors) and returns: input_fn, parse_example, batch_features,  batch_features, tf