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

Function get_meta_graph_def

tensorflow/python/tools/saved_model_utils.py:95–120  ·  view source on GitHub ↗

Gets MetaGraphDef from SavedModel. Returns the MetaGraphDef for the given tag-set and SavedModel directory. Args: saved_model_dir: Directory containing the SavedModel to inspect or execute. tag_set: Group of tag(s) of the MetaGraphDef to load, in string format, separated by ','

(saved_model_dir, tag_set)

Source from the content-addressed store, hash-verified

93
94
95def get_meta_graph_def(saved_model_dir, tag_set):
96 """Gets MetaGraphDef from SavedModel.
97
98 Returns the MetaGraphDef for the given tag-set and SavedModel directory.
99
100 Args:
101 saved_model_dir: Directory containing the SavedModel to inspect or execute.
102 tag_set: Group of tag(s) of the MetaGraphDef to load, in string format,
103 separated by ','. For tag-set contains multiple tags, all tags must be
104 passed in.
105
106 Raises:
107 RuntimeError: An error when the given tag-set does not exist in the
108 SavedModel.
109
110 Returns:
111 A MetaGraphDef corresponding to the tag-set.
112 """
113 saved_model = read_saved_model(saved_model_dir)
114 set_of_tags = set(tag_set.split(','))
115 for meta_graph_def in saved_model.meta_graphs:
116 if set(meta_graph_def.meta_info_def.tags) == set_of_tags:
117 return meta_graph_def
118
119 raise RuntimeError('MetaGraphDef associated with tag-set ' + tag_set +
120 ' could not be found in SavedModel')

Callers

nothing calls this directly

Calls 2

read_saved_modelFunction · 0.70
splitMethod · 0.45

Tested by

no test coverage detected