code: def remap_input_source(input, names):
      """
      When you have some :class:`InputSource` which doesn't match the inputs of
      your tower function, use `RemapInputSource`.
      It produces placeholders for all the inputs in your model,
      except that the corresponding ones are replaced with the tensor produced
      by the given :class:`InputSource`.
  
      Example:
  
      .. code-block:: python
  
          input1 = QueueInput(ds)
          # assume ds produces data that should be fed to 'image' and 'label',
          # but the graph takes more inputs for some reasons, or takes inputs
          # of a different order, for example like the following:
  
          # input_signature = [tf.TensorSpec((None,10), tf.float32, 'score'),
          #                    tf.TensorSpec((None,20,20,3), tf.float32, 'label'),
          #                    tf.TensorSpec((None,), tf.int32, 'image') ]
  
          input2 = remap_input_source(input1, ['image', 'label'])
          # now, if input2 is used with the above input_signature, it will return a
          # placeholder for 'score', plus the tensors returned by input1
      """
  
      def __init__(self, input, names):
          """
          Args:
              input(InputSource): a :class:`InputSource`, whose tensors will get mapped.
              names(list[str]): list of input names corresponding to the tensors
                  produced by ``input``.
  
          Returns:
              InputSource:
          """
          ProxyInputSource.__init__(self, input)
          assert isinstance(names, (list, tuple)), names
          self._names = tuple(names)
  
      def _setup(self, inputs):
          self._all_placehdrs = [
              build_or_reuse_placeholder(v) for v in inputs
          ]
          inputs_subset = get_sublist_by_names(inputs, self._names)
          self._input.setup(inputs_subset)
  
      def _get_input_tensors(self):
          ret = self._input.get_input_tensors()
          assert len(ret) == len(self._names)
          return get_tensors_inputs(
              self._all_placehdrs, ret, self._names
          )
  
      oldcls = type(input)
      # inherit oldcls so that type check in various places would work
      cls = type(
          "Remapped" + oldcls.__name__,
          (ProxyInputSource, oldcls),
          {
              "__init__": __init__,
              "_setup": _setup,
              "_get_input_tensors": _get_input_tensors,
          },
      )
      return cls(input, names)
  
imports: import copy
  from abc import ABCMeta, abstractmethod
  from contextlib import contextmanager
  import six
  import tensorflow
  from ..callbacks.base import CallbackFactory
  from ..tfutils.common import get_op_tensor_name
  from ..utils import logger
  from ..utils.argtools import call_only_once, memoized_method
  from ..compat import tfv1
label_desc: Use image node_id 4 for calling a global function with example usage: remap_input_source(input, names) and returns: cls, get_tensors_inputs