from tensorflow.python.framework import ops as _ops
from tensorflow.python.saved_model import constants as _saved_model_constants
from tensorflow.python.training import saver as _saver_lib
-from tensorflow.python.util import compat
+from tensorflow.python.util import compat as _compat
from tensorflow.tools import graph_transforms as _graph_transforms
shapes = []
dtypes = []
for index, value in enumerate(name_op_value_tensor.string_val):
- if not _is_removed(compat.as_str(value), removed_op_names):
+ if not _is_removed(_compat.as_str(value), removed_op_names):
names.append(value)
shapes.append(shape_op_value_tensor.string_val[index])
dtypes.append(op.attr['dtypes'].list.type[index])
# /foo/bar. This regex ensures that we handle these two nodes
# as separate entities. It matches on nodes having names in the form of
# '/foo/bar_x' as well as nodes having names in the form of 'foo.'
- s_names = _re.findall(r'((?:[\/]?[a-zA-Z0-9\_]*)*)', compat.as_str_any(s))
+ s_names = _re.findall(r'((?:[\/]?[a-zA-Z0-9\_]*)*)', _compat.as_str_any(s))
for removed_op_name in removed_op_names:
for s_name in s_names:
if s_name.endswith(removed_op_name):
for tag in tags:
meta_graph_def.meta_info_def.tags.append(tag)
- base_op_names = [compat.as_str(node.name)
+ base_op_names = [_compat.as_str(node.name)
for node in base_meta_graph_def.graph_def.node]
- retained_op_names = [compat.as_str(node.name)
+ retained_op_names = [_compat.as_str(node.name)
for node in meta_graph_def.graph_def.node]
removed_op_names = set(base_op_names) - set(retained_op_names)