tensorflow/core/tpu/graph_rewrite/tpu_embedding_software_deduplication_rewrite_pass.cc
// Rewrites the graph in the specified GraphOptimizationPassOptions object for
// software deduplication.
Rewrites the graph in the specified GraphOptimizationPassOptions object for
software deduplication.
Rewrites the graph in the specified GraphOptimizationPassOptions object for software deduplication .
Status RewriteGraph(Graph* graph) {
  SendRecvNodesMap send_recv_nodes_map;
  TF_RETURN_IF_ERROR(GroupSendRecvNodesByTpuReplicateAttrAndDevice(
      graph, &send_recv_nodes_map));
  for (const auto& attr_send_recv_nodes_pair : send_recv_nodes_map) {
    const std::string& tpu_replicate_attr =
        attr_send_recv_nodes_pair.first.tpu_replicate_attr;
    const std::string& requested_device =
        attr_send_recv_nodes_pair.first.requested_device;
    Node* activations_node = attr_send_recv_nodes_pair.second.activations_node;
    Node* gradients_node = attr_send_recv_nodes_pair.second.gradients_node;
    TF_RETURN_IF_ERROR(RewriteGraphForTpuReplicateAttrAndDevice(
        tpu_replicate_attr, requested_device, activations_node, gradients_node,
        graph));
  }
  return Status::OK();
}
Status RewriteGraph ( Graph * graph ) { SendRecvNodesMap send_recv_nodes_map ; TF_RETURN_IF_ERROR ( GroupSendRecvNodesByTpuReplicateAttrAndDevice ( graph , & send_recv_nodes_map ) ) ; for ( const auto & attr_send_recv_nodes_pair : send_recv_nodes_map ) { const std :: string & tpu_replicate_attr = attr_send_recv_nodes_pair . first . tpu_replicate_attr ; const std :: string & requested_device = attr_send_recv_nodes_pair . first . requested_device ; Node * activations_node = attr_send_recv_nodes_pair . second . activations_node ; Node * gradients_node = attr_send_recv_nodes_pair . second . gradients_node ; TF_RETURN_IF_ERROR ( RewriteGraphForTpuReplicateAttrAndDevice ( tpu_replicate_attr , requested_device , activations_node , gradients_node , graph ) ) ; } return Status :: OK ( ) ; }
Rewrites the graph in the specified GraphOptimizationPassOptions object for
software deduplication.
Rewrites the graph in the specified GraphOptimizationPassOptions object for software deduplication .