code: def _get_previous_subgraph_layer_output_node_names(
      remote_op_layer: Set[str],
      node_name_to_node_def: Mapping[str, tf.compat.v1.NodeDef],
  ) -> Set[str]:
      """Gets the output node names of the previous subgraph layer.
  
      Given a remote op layer, we derive the output node names of the previous
      subgraph layer. Layers tend to have the following order: subgraph layer,
      remote op layer, subgraph layer, remote op layer, ...
  
      Args:
        remote_op_layer: A set of remote op names for a remote op layer.
        node_name_to_node_def: A mapping from node names to `NodeDef` protos.
  
      Returns:
        A set of output node names of the previous subgraph layer.
      """
      previous_subgraph_layer_output_node_names = set()
  
      for remote_op_name in remote_op_layer:
          for input_node_name in node_name_to_node_def[
              remote_op_name
          ].input:
              input_node = node_name_to_node_def[input_node_name]
  
              # Assumption: Graph inputs and previous remote op outputs are always
              #             computed and stored.
              if _is_placeholder_op(input_node) or _is_remote_op(
                  input_node
              ):
                  continue
              previous_subgraph_layer_output_node_names.add(
                  input_node_name
              )
  
      return previous_subgraph_layer_output_node_names
  
imports: import collections
  from typing import Dict, List, Mapping, Set
  import tensorflow
  from tfx.dsl.io import fileio
  from tfx.experimental.distributed_inference.graphdef_experiments.subgraph_partitioning import execution_spec
label_desc: Use image node_id 12 for calling a global function with example usage: _get_previous_subgraph_layer_output_node_names(remote_op_layer, node_name_to_node_def) and returns: previous_subgraph_layer_output_node_names