code: def _LoadRemoteGraphInputs(  # pylint: disable=invalid-name
      pcoll: beam.pvalue.PCollection,
      parent_remote_op_name: str,
      child_remote_op_name: str,
      remote_op_name_to_graph_name: Mapping[str, str],
      graph_to_remote_op_input_name_mapping: Mapping[
          str, Mapping[str, Mapping[str, str]]
      ],
  ) -> beam.pvalue.PCollection:
      """A PTransform that prepares inputs for a remote graph.
  
      Before executing a remote graph, we need to prepare its inputs. We first
      get the mapping from remote graph placeholder names to parent graph input
      names. Then, in a copy of element, we copy the inputs from the parent
      graph's key to the remote graph's key.
  
      Args:
        pcoll: A PCollection of child graph inputs not loaded yet. Each element is a
          dictionary from remote op names to a dictionary from tensor names to
          values. Here, element[child_remote_op_name] is empty now.
        parent_remote_op_name: The remote op name of the parent graph.
        child_remote_op_name: The remote op name of the child graph.
        remote_op_name_to_graph_name: A mapping from remote op names to graph names.
        graph_to_remote_op_input_name_mapping: A mapping from graph names to remote
          op names to remote graph placeholder names to parent graph input names.
          {graph name: {remote op name: {placeholder name: input name}}}.
  
      Returns:
        A PCollection of inputs to the child graph. Each element is a dictionary
        from remote op names to a dictionary from tensor names to values. Here,
        element[child_remote_op_name] stores the inputs of child graph.
      """
      parent_graph_name = remote_op_name_to_graph_name[
          parent_remote_op_name
      ]
      name_mapping = graph_to_remote_op_input_name_mapping[
          parent_graph_name
      ][child_remote_op_name]
  
      mapping = name_mapping.items()
      # Calling _copy_tensor_value multiple times may introduce a burden, since
      # _copy_tensor_value invokes a deepcopy on element.
      for (
          child_graph_placeholder_name,
          parent_graph_input_name,
      ) in mapping:
          step_name = "PrepareInput[Graph_%s][Input_%s]" % (
              child_remote_op_name,
              child_graph_placeholder_name,
          )
          pcoll = pcoll | step_name >> beam.Map(
              _copy_tensor_value,
              parent_remote_op_name,
              _import_tensor_name(parent_graph_input_name),
              child_remote_op_name,
              _import_tensor_name(child_graph_placeholder_name),
          )
  
      return pcoll
  
file_path: tfx/tfx/experimental/distributed_inference/graphdef_experiments/subgraph_partitioning/beam_pipeline.py
imports: import copy
  from typing import Any, Dict, Iterator, List, Mapping
  import apache_beam
  import tensorflow
  from tfx.experimental.distributed_inference.graphdef_experiments.subgraph_partitioning import execution_spec
label_desc: Use image node_id 3 for calling a global function with example usage: _LoadRemoteGraphInputs(pcoll, parent_remote_op_name, child_remote_op_name, remote_op_name_to_graph_name, graph_to_remote_op_input_name_mapping) and returns: pcoll