diff --git a/tensorflow/core/framework/graph_def_util.h b/tensorflow/core/framework/graph_def_util.h index ac1595ca333..5fbf7978bd5 100644 --- a/tensorflow/core/framework/graph_def_util.h +++ b/tensorflow/core/framework/graph_def_util.h @@ -65,7 +65,8 @@ Status AddDefaultAttrsToGraphDef(GraphDef* graph_def, // compatible. If not nulllptr, the op/attr pairs that were removed // are added to '*op_attr_removed'. // -// Expected usage: +// Expected usage, for a producer that wants to prepare a graph for +// a consumer: // // For each consumer, update 'graph_def': // OpListOpRegistry consumer_op_registry(consumer_server_op_list); // std::unordered_set> op_attr_removed; @@ -78,8 +79,12 @@ Status AddDefaultAttrsToGraphDef(GraphDef* graph_def, // // Consumer can use 'graph_def', and 'op_attr_removed' summarizes // // what changes had to be made to 'graph_def' for it to work. // -// TODO(josh11b): Describe how to use this function on the consumer using the -// stripped_op_list field from a producer. +// Expected usage, for a consumer that has a graph and a +// (optionally-stripped) op_list from a producer (say from a call to +// StrippedOpListForGraph(), or in the MetaGraphDef): +// OpListOpRegistry producer_op_registry(producer_stripped_op_list); +// TF_RETURN_IF_ERROR(RemoveNewDefaultAttrsFromGraphDef( +// &graph_def, *OpRegistry::Global(), producer_op_registry, nullptr)); Status RemoveNewDefaultAttrsFromGraphDef( GraphDef* graph_def, const OpRegistryInterface& consumer_op_registry, const OpRegistryInterface& producer_op_registry, @@ -87,13 +92,14 @@ Status RemoveNewDefaultAttrsFromGraphDef( // Collect the ops used by a graph. // -// This function computes the stripped_op_list field of MetaGraphDef and similar -// protos. The op_registry should contain the ops used to produce graph_def, -// and stripped_op_list can be used as the producer_op_registry argument to -// RemoveNewDefaultAttrsFromGraphDef to improve forwards compatibility -// (using OpListOpRegistry to turn the OpList into an OpRegistryInterface). +// This function computes the stripped_op_list field of MetaGraphDef +// and similar protos. The op_registry should contain the ops used to +// produce graph_def. The resulting stripped_op_list can be +// communicated from the producer to the consumer, which can use +// RemoveNewDefaultAttrsFromGraphDef() to improve forwards compatibility +// (using an OpListOpRegistry as indicated in the example above). // -// Most users will pass OpRegistry::Global() for op_registry to strip against +// Most users will pass *OpRegistry::Global() for op_registry to strip against // the list of ops registered in this process. Status StrippedOpListForGraph(const GraphDef& graph_def, const OpRegistryInterface& op_registry,