diff options
author | Eugene Brevdo <ebrevdo@google.com> | 2016-10-06 16:08:04 -0800 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2016-10-06 17:18:08 -0700 |
commit | 752c24070f890519729e1c8f4c562dd25b9e98bd (patch) | |
tree | 1629770a728a7d9f2b7036445586555ceebb28c8 /tensorflow/contrib/testing | |
parent | 12167ee7a192fcfe0e9f468af88ebcced2bc4a2e (diff) |
Allow writing the MetaGraphDef to an event summary.
Supervisor and graph_actions now do this by default if saving a graph is requested.
TensorBoard can now fall back to using the MetaGraphDef if the GraphDef is not
available in the Event.
Other changes include:
* factor out metagraph code from training.saver to framework.meta_graph
* update the summary writer, session hooks, and supervisor to support these new summaries
Change: 135424442
Diffstat (limited to 'tensorflow/contrib/testing')
-rw-r--r-- | tensorflow/contrib/testing/python/framework/fake_summary_writer.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/tensorflow/contrib/testing/python/framework/fake_summary_writer.py b/tensorflow/contrib/testing/python/framework/fake_summary_writer.py index f64f71f417..7966b1a2c0 100644 --- a/tensorflow/contrib/testing/python/framework/fake_summary_writer.py +++ b/tensorflow/contrib/testing/python/framework/fake_summary_writer.py @@ -50,6 +50,7 @@ class FakeSummaryWriter(object): self._graph = graph self._summaries = {} self._added_graphs = [] + self._added_meta_graphs = [] self._added_session_logs = [] @property @@ -59,7 +60,7 @@ class FakeSummaryWriter(object): def assert_summaries( self, test_case, expected_logdir=None, expected_graph=None, expected_summaries=None, expected_added_graphs=None, - expected_session_logs=None): + expected_added_meta_graphs=None, expected_session_logs=None): """Assert expected items have been added to summary writer.""" if expected_logdir is not None: test_case.assertEqual(expected_logdir, self._logdir) @@ -80,6 +81,8 @@ class FakeSummaryWriter(object): test_case.assertEqual(expected_summaries[step], actual_simple_values) if expected_added_graphs is not None: test_case.assertEqual(expected_added_graphs, self._added_graphs) + if expected_added_meta_graphs is not None: + test_case.assertEqual(expected_added_meta_graphs, self._added_meta_graphs) if expected_session_logs is not None: test_case.assertEqual(expected_session_logs, self._added_session_logs) @@ -105,6 +108,12 @@ class FakeSummaryWriter(object): raise ValueError('Unexpected graph_def %s.' % graph_def) self._added_graphs.append(graph) + def add_meta_graph(self, meta_graph_def, global_step=None): + """Add metagraph.""" + if (global_step is not None) and (global_step < 0): + raise ValueError('Invalid global_step %s.' % global_step) + self._added_meta_graphs.append(meta_graph_def) + # NOTE: Ignore global_step since its value is non-deterministic. def add_session_log(self, session_log, global_step=None): # pylint: disable=unused-argument |