tf.compat.v1.train.export_meta_graph
Stay organized with collections
Save and categorize content based on your preferences.
Returns MetaGraphDef
proto.
tf.compat.v1.train.export_meta_graph(
filename=None,
meta_info_def=None,
graph_def=None,
saver_def=None,
collection_list=None,
as_text=False,
graph=None,
export_scope=None,
clear_devices=False,
clear_extraneous_savers=False,
strip_default_attrs=False,
save_debug_info=False,
**kwargs
)
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.
Args |
filename
|
Optional filename including the path for writing the generated
MetaGraphDef protocol buffer.
|
meta_info_def
|
MetaInfoDef protocol buffer.
|
graph_def
|
GraphDef protocol buffer.
|
saver_def
|
SaverDef protocol buffer.
|
collection_list
|
List of string keys to collect.
|
as_text
|
If True , writes the MetaGraphDef as an ASCII proto.
|
graph
|
The Graph to export. If None , use the default graph.
|
export_scope
|
Optional string . Name scope under which to extract the
subgraph. The scope name will be striped from the node definitions for
easy import later into new name scopes. If None , the whole graph is
exported. graph_def and export_scope cannot both be specified.
|
clear_devices
|
Whether or not to clear the device field for an Operation
or Tensor during export.
|
clear_extraneous_savers
|
Remove any Saver-related information from the graph
(both Save/Restore ops and SaverDefs) that are not associated with the
provided SaverDef.
|
strip_default_attrs
|
Boolean. If True , default-valued attributes will be
removed from the NodeDefs. For a detailed guide, see Stripping
Default-Valued
Attributes.
|
save_debug_info
|
If True , save the GraphDebugInfo to a separate file,
which in the same directory of filename and with _debug added before the
file extend.
|
**kwargs
|
Optional keyed arguments.
|
Returns |
A MetaGraphDef proto.
|
Raises |
ValueError
|
When the GraphDef is larger than 2GB.
|
RuntimeError
|
If called with eager execution enabled.
|
Exporting/importing meta graphs is not supported unless both graph_def
and
graph
are provided. No graph exists when eager execution is enabled.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.
Last updated 2024-04-26 UTC.
[null,null,["Last updated 2024-04-26 UTC."],[],[],null,["# tf.compat.v1.train.export_meta_graph\n\n\u003cbr /\u003e\n\n|--------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.16.1/tensorflow/python/training/saver.py#L1644-L1727) |\n\nReturns `MetaGraphDef` proto. \n\n tf.compat.v1.train.export_meta_graph(\n filename=None,\n meta_info_def=None,\n graph_def=None,\n saver_def=None,\n collection_list=None,\n as_text=False,\n graph=None,\n export_scope=None,\n clear_devices=False,\n clear_extraneous_savers=False,\n strip_default_attrs=False,\n save_debug_info=False,\n **kwargs\n )\n\nOptionally writes it to filename.\n\nThis function exports the graph, saver, and collection objects into\n`MetaGraphDef` protocol buffer with the intention of it being imported\nat a later time or location to restart training, run inference, or be\na subgraph.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|---------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `filename` | Optional filename including the path for writing the generated `MetaGraphDef` protocol buffer. |\n| `meta_info_def` | `MetaInfoDef` protocol buffer. |\n| `graph_def` | `GraphDef` protocol buffer. |\n| `saver_def` | `SaverDef` protocol buffer. |\n| `collection_list` | List of string keys to collect. |\n| `as_text` | If `True`, writes the `MetaGraphDef` as an ASCII proto. |\n| `graph` | The `Graph` to export. If `None`, use the default graph. |\n| `export_scope` | Optional `string`. Name scope under which to extract the subgraph. The scope name will be striped from the node definitions for easy import later into new name scopes. If `None`, the whole graph is exported. graph_def and export_scope cannot both be specified. |\n| `clear_devices` | Whether or not to clear the device field for an `Operation` or `Tensor` during export. |\n| `clear_extraneous_savers` | Remove any Saver-related information from the graph (both Save/Restore ops and SaverDefs) that are not associated with the provided SaverDef. |\n| `strip_default_attrs` | Boolean. If `True`, default-valued attributes will be removed from the NodeDefs. For a detailed guide, see [Stripping Default-Valued Attributes](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/saved_model/README.md#stripping-default-valued-attributes). |\n| `save_debug_info` | If `True`, save the GraphDebugInfo to a separate file, which in the same directory of filename and with `_debug` added before the file extend. |\n| `**kwargs` | Optional keyed arguments. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| A `MetaGraphDef` proto. ||\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Raises ------ ||\n|----------------|-----------------------------------------|\n| `ValueError` | When the `GraphDef` is larger than 2GB. |\n| `RuntimeError` | If called with eager execution enabled. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\neager compatibility\n-------------------\n\n\u003cbr /\u003e\n\nExporting/importing meta graphs is not supported unless both `graph_def` and\n`graph` are provided. No graph exists when eager execution is enabled.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e"]]