diff options
author | 2017-06-12 11:27:22 -0700 | |
---|---|---|
committer | 2017-06-12 11:30:55 -0700 | |
commit | 2d1823f7be0d65d4ee28b7c6ea2acaac01f1db61 (patch) | |
tree | 9c234b418510121149dfd29fc9580d0e2cc3cc91 /tensorflow/python/framework/meta_graph.py | |
parent | b4aa475f0375ea3d007fd4c3c95d9e1971a13bfd (diff) |
Added proto function for LOCAL_VARIABLES and MODEL_VARIABLES.
PiperOrigin-RevId: 158739297
Diffstat (limited to 'tensorflow/python/framework/meta_graph.py')
-rw-r--r-- | tensorflow/python/framework/meta_graph.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/tensorflow/python/framework/meta_graph.py b/tensorflow/python/framework/meta_graph.py index e46c56ddd1..9f4e4a18f2 100644 --- a/tensorflow/python/framework/meta_graph.py +++ b/tensorflow/python/framework/meta_graph.py @@ -44,6 +44,11 @@ from tensorflow.python.util import compat # Prefix to be added to unbound input names so they are easily identifiable. _UNBOUND_INPUT_PREFIX = "$unbound_inputs_" +# List of collections that didn't register proto functions, as a result in +# a previously exported meta_graph the items are of a different data type. +_COMPAT_COLLECTION_LIST = [ops.GraphKeys.LOCAL_VARIABLES, + ops.GraphKeys.MODEL_VARIABLES] + def _node_def(from_node_def, export_scope, unbound_inputs, clear_devices=False): """Create a `NodeDef` proto with export_scope stripped. @@ -667,8 +672,7 @@ def import_scoped_meta_graph(meta_graph_or_file, key) continue from_proto = ops.get_from_proto_function(key) - if from_proto: - assert kind == "bytes_list" + if from_proto and kind == "bytes_list": proto_type = ops.get_collection_proto_type(key) for value in col_def.bytes_list.value: proto = proto_type() @@ -677,6 +681,11 @@ def import_scoped_meta_graph(meta_graph_or_file, key, from_proto(proto, import_scope=scope_to_prepend_to_names)) else: field = getattr(col_def, kind) + if key in _COMPAT_COLLECTION_LIST: + logging.warning( + "The saved meta_graph is possibly from an older release:\n" + "'%s' collection should be of type 'byte_list', but instead " + "is of type '%s'.", key, kind) if kind == "node_list": for value in field.value: col_op = graph.as_graph_element( |