def _rewrite_graph(self, transform):
input_map = {k.name: v for k, v in transform.items()}
# Modify the input dictionary to replace variables which have been
# superseded with the use of combinators
for k, v in self._silently_replace.items():
input_map[k.name] = self._observed[v]
with self.session.graph.as_default():
try:
tf.import_graph_def(
self._model_graph.as_graph_def(),
input_map=input_map,
name='added',
)
except ValueError:
# Ignore errors that ocour when the input_map tries to
# rewrite a variable that isn't present in the graph
pass
评论列表
文章目录