MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / export_scoped_meta_graph

Function export_scoped_meta_graph

tensorflow/python/framework/meta_graph.py:917–1081  ·  view source on GitHub ↗

Returns `MetaGraphDef` proto. Optionally writes it to filename. This function exports the graph, saver, and collection objects into `MetaGraphDef` protocol buffer with the intention of it being imported at a later time or location to restart training, run inference, or be a subgraph. Arg

(filename=None,
                             graph_def=None,
                             graph=None,
                             export_scope=None,
                             as_text=False,
                             unbound_inputs_col_name="unbound_inputs",
                             clear_devices=False,
                             saver_def=None,
                             clear_extraneous_savers=False,
                             strip_default_attrs=False,
                             save_debug_info=False,
                             incr_saver_def=None,
                             **kwargs)

Source from the content-addressed store, hash-verified

915
916
917def export_scoped_meta_graph(filename=None,
918 graph_def=None,
919 graph=None,
920 export_scope=None,
921 as_text=False,
922 unbound_inputs_col_name="unbound_inputs",
923 clear_devices=False,
924 saver_def=None,
925 clear_extraneous_savers=False,
926 strip_default_attrs=False,
927 save_debug_info=False,
928 incr_saver_def=None,
929 **kwargs):
930 """Returns `MetaGraphDef` proto. Optionally writes it to filename.
931
932 This function exports the graph, saver, and collection objects into
933 `MetaGraphDef` protocol buffer with the intention of it being imported
934 at a later time or location to restart training, run inference, or be
935 a subgraph.
936
937 Args:
938 filename: Optional filename including the path for writing the
939 generated `MetaGraphDef` protocol buffer.
940 graph_def: `GraphDef` protocol buffer.
941 graph: The `Graph` to export. If `None`, use the default graph.
942 export_scope: Optional `string`. Name scope under which to extract
943 the subgraph. The scope name will be stripped from the node definitions
944 for easy import later into new name scopes. If `None`, the whole graph
945 is exported.
946 as_text: If `True`, writes the `MetaGraphDef` as an ASCII proto.
947 unbound_inputs_col_name: Optional `string`. If provided, a string collection
948 with the given name will be added to the returned `MetaGraphDef`,
949 containing the names of tensors that must be remapped when importing the
950 `MetaGraphDef`.
951 clear_devices: Boolean which controls whether to clear device information
952 before exporting the graph.
953 saver_def: `SaverDef` protocol buffer.
954 clear_extraneous_savers: Remove any Saver-related information from the
955 graph (both Save/Restore ops and SaverDefs) that are not associated
956 with the provided SaverDef.
957 strip_default_attrs: Set to true if default valued attributes must be
958 removed while exporting the GraphDef.
959 save_debug_info: If `True`, save the GraphDebugInfo to a separate file,
960 which in the same directory of filename and with `_debug` added before the
961 file extension.
962 **kwargs: Optional keyed arguments, including meta_info_def and
963 collection_list.
964
965 Returns:
966 A `MetaGraphDef` proto and dictionary of `Variables` in the exported
967 name scope.
968
969 Raises:
970 ValueError: When the `GraphDef` is larger than 2GB.
971 ValueError: When executing in Eager mode and either `graph_def` or `graph`
972 is undefined.
973 """
974 if context.executing_eagerly() and not (graph_def is not None and

Callers 1

copy_scoped_meta_graphFunction · 0.85

Calls 15

_should_include_nodeFunction · 0.85
_node_defFunction · 0.85
create_meta_graph_defFunction · 0.85
executing_eagerlyMethod · 0.80
as_graph_defMethod · 0.80
as_protoMethod · 0.80
ByteSizeMethod · 0.80
clear_collectionMethod · 0.80
add_to_collectionMethod · 0.80
get_operation_by_nameMethod · 0.80

Tested by

no test coverage detected