tensorflow/core/tpu/graph_rewrite/tpu_embedding_software_deduplication_rewrite_pass.cc
// Computes the RewriterConfig for the specified node_def.
Computes the RewriterConfig for the specified node_def.
Computes the RewriterConfig for the specified node_def .
xla::StatusOr<RewriterConfig> ComputeRewriterConfigForNodeDef(
    const NodeDef& node_def) {
  RewriterConfig rewriter_config;
  TF_RET_CHECK(!node_def.name().empty());
  if (node_def.op() == "RecvTPUEmbeddingActivations") {
    rewriter_config.activations_node_def_name = node_def.name();
  } else {
    TF_RET_CHECK(node_def.op() == "SendTPUEmbeddingGradients");
    rewriter_config.gradients_node_def_name = node_def.name();
  }
  rewriter_config.device_name = node_def.device();
  const AttrSlice attr_slice(node_def);
  TF_RETURN_IF_ERROR(GetNodeAttr(attr_slice, "config",
                                 &rewriter_config.tpu_embedding_config_str));
  {
    std::string test_tpu_replicate_attr;
    if (GetNodeAttr(attr_slice, "_tpu_replicate", &test_tpu_replicate_attr)
            .ok()) {
      rewriter_config.tpu_replicate_attr = test_tpu_replicate_attr;
    }
  }
  rewriter_config.control_inputs = GetControlInputs(node_def);
  return rewriter_config;
}
xla :: StatusOr < RewriterConfig > ComputeRewriterConfigForNodeDef ( const NodeDef & node_def ) { RewriterConfig rewriter_config ; TF_RET_CHECK ( ! node_def . name ( ) . empty ( ) ) ; if ( node_def . op ( ) == " " ) { rewriter_config . activations_node_def_name = node_def . name ( ) ; } else { TF_RET_CHECK ( node_def . op ( ) == " " ) ; rewriter_config . gradients_node_def_name = node_def . name ( ) ; } rewriter_config . device_name = node_def . device ( ) ; const AttrSlice attr_slice ( node_def ) ; TF_RETURN_IF_ERROR ( GetNodeAttr ( attr_slice , " " , & rewriter_config . tpu_embedding_config_str ) ) ; { std :: string test_tpu_replicate_attr ; if ( GetNodeAttr ( attr_slice , " " , & test_tpu_replicate_attr ) . ok ( ) ) { rewriter_config . tpu_replicate_attr = test_tpu_replicate_attr ; } } rewriter_config . control_inputs = GetControlInputs ( node_def ) ; return rewriter_config ; }
Computes the RewriterConfig for the specified node_def.
Computes the RewriterConfig for the specified node_def .