Exports ModuleAttachments from the current tf.Graph into `meta_graph`.
(meta_graph)
| 151 | |
| 152 | |
| 153 | def _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 | |
| 166 | def get_attached_bytes_map(meta_graph): |