diff options
author | Dan Mané <danmane@google.com> | 2016-10-06 15:02:13 -0800 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2016-10-06 16:16:40 -0700 |
commit | cbf1ca9b4a146e7a0434771396f18476dd38af81 (patch) | |
tree | 058beea8838058ed6034691a222cdb7fe016df96 /tensorflow/contrib/testing | |
parent | b6ab74756f171e599e62b1fe16617ebed115d172 (diff) |
Refactor and reorganize SummaryWriter code.
- Split SummaryWriter implementation into two pieces:
*** SummaryToEventTransformer, which implements the functional API that transforms summaries and other data into Event protocol buffers
*** EventFileWriter, which takes Event protocol buffers and writes them to disk
As the summary-transformer logic in SummaryWriter grows more complicated, this decomposition makes it much easier to test. Also, it will faciltiate adding other event-writing backends in the future.
- Create LegacySummaryWriter, which is the composition of those two pieces and has an API that is identical to the current tf.train.SummaryWriter
- Move the SummaryWriter code into python/summary and out of python/training
- Reimport the code to training/summary_io, so that no one downstream notices any changes.
Change: 135417373
Diffstat (limited to 'tensorflow/contrib/testing')
-rw-r--r-- | tensorflow/contrib/testing/python/framework/fake_summary_writer.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tensorflow/contrib/testing/python/framework/fake_summary_writer.py b/tensorflow/contrib/testing/python/framework/fake_summary_writer.py index 8f207640d4..f64f71f417 100644 --- a/tensorflow/contrib/testing/python/framework/fake_summary_writer.py +++ b/tensorflow/contrib/testing/python/framework/fake_summary_writer.py @@ -17,7 +17,9 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function + from tensorflow.core.framework import summary_pb2 +from tensorflow.python.summary.writer import writer_cache from tensorflow.python.training import summary_io @@ -33,12 +35,14 @@ class FakeSummaryWriter(object): raise ValueError('FakeSummaryWriter already installed.') cls._replaced_summary_writer = summary_io.SummaryWriter summary_io.SummaryWriter = FakeSummaryWriter + writer_cache.SummaryWriter = FakeSummaryWriter @classmethod def uninstall(cls): if not cls._replaced_summary_writer: raise ValueError('FakeSummaryWriter not installed.') summary_io.SummaryWriter = cls._replaced_summary_writer + writer_cache.SummaryWriter = cls._replaced_summary_writer cls._replaced_summary_writer = None def __init__(self, logdir, graph=None): |