MCPcopy Create free account
hub / github.com/tensorflow/hub / _export_module_attachments

Function _export_module_attachments

tensorflow_hub/saved_model_lib.py:153–163  ·  view source on GitHub ↗

Exports ModuleAttachments from the current tf.Graph into `meta_graph`.

(meta_graph)

Source from the content-addressed store, hash-verified

151
152
153def _export_module_attachments(meta_graph):
154 """Exports ModuleAttachments from the current tf.Graph into `meta_graph`."""
155 added_attachments = tf.compat.v1.get_collection(
156 _ATTACHMENT_COLLECTION_INTERNAL)
157 if not added_attachments: return # Don't touch `meta_graph`.
158 unique_attachments = collections.OrderedDict( # Avoid indeterminism.
159 (attachment.key, attachment)
160 for attachment in added_attachments)
161 meta_graph.collection_def[ATTACHMENT_COLLECTION_SAVED].bytes_list.value[:] = [
162 attachment.SerializeToString()
163 for attachment in unique_attachments.values()]
164
165
166def get_attached_bytes_map(meta_graph):

Callers 1

add_graph_copyMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected