aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/contrib/summary
diff options
context:
space:
mode:
authorGravatar Justine Tunney <jart@google.com>2017-12-01 15:48:30 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2017-12-01 15:52:16 -0800
commitde1ee126c094c840668d5e794e347159be66b23c (patch)
treedb08e88ab5f2272afef936f2c22457d9282c59dc /tensorflow/contrib/summary
parentab0c520c7f58386e0141a3c515acea19033410a6 (diff)
Rename create_summary_file_writer to create_file_writer
PiperOrigin-RevId: 177651937
Diffstat (limited to 'tensorflow/contrib/summary')
-rw-r--r--tensorflow/contrib/summary/summary.py3
-rw-r--r--tensorflow/contrib/summary/summary_ops.py35
-rw-r--r--tensorflow/contrib/summary/summary_ops_graph_test.py6
-rw-r--r--tensorflow/contrib/summary/summary_ops_test.py30
-rw-r--r--tensorflow/contrib/summary/summary_test_internal.py4
-rw-r--r--tensorflow/contrib/summary/summary_test_util.py4
6 files changed, 46 insertions, 36 deletions
diff --git a/tensorflow/contrib/summary/summary.py b/tensorflow/contrib/summary/summary.py
index 9e6af5232f..7d3b8b7437 100644
--- a/tensorflow/contrib/summary/summary.py
+++ b/tensorflow/contrib/summary/summary.py
@@ -28,7 +28,8 @@ from __future__ import print_function
from tensorflow.contrib.summary.summary_ops import all_summary_ops
from tensorflow.contrib.summary.summary_ops import always_record_summaries
from tensorflow.contrib.summary.summary_ops import audio
-from tensorflow.contrib.summary.summary_ops import create_summary_db_writer
+from tensorflow.contrib.summary.summary_ops import create_db_writer
+from tensorflow.contrib.summary.summary_ops import create_file_writer
from tensorflow.contrib.summary.summary_ops import create_summary_file_writer
from tensorflow.contrib.summary.summary_ops import eval_dir
from tensorflow.contrib.summary.summary_ops import flush
diff --git a/tensorflow/contrib/summary/summary_ops.py b/tensorflow/contrib/summary/summary_ops.py
index de6f2cd79f..4556162bfe 100644
--- a/tensorflow/contrib/summary/summary_ops.py
+++ b/tensorflow/contrib/summary/summary_ops.py
@@ -38,9 +38,11 @@ from tensorflow.python.ops import control_flow_ops
from tensorflow.python.ops import math_ops
from tensorflow.python.ops import resource_variable_ops
from tensorflow.python.ops import summary_op_util
+from tensorflow.python.platform import tf_logging as logging
from tensorflow.python.training import training_util
from tensorflow.python.util import tf_contextlib
+
# Name for a collection which is expected to have at most a single boolean
# Tensor. If this tensor is True the summary ops will record summaries.
_SHOULD_RECORD_SUMMARIES_NAME = "ShouldRecordSummaries"
@@ -102,8 +104,8 @@ class SummaryWriter(object):
"""Encapsulates a stateful summary writer resource.
See also:
- - @{tf.contrib.summary.create_summary_file_writer}
- - @{tf.contrib.summary.create_summary_db_writer}
+ - @{tf.contrib.summary.create_file_writer}
+ - @{tf.contrib.summary.create_db_writer}
"""
def __init__(self, resource):
@@ -169,11 +171,11 @@ def initialize(
session.run(_graph(x, 0), feed_dict={x: data})
-def create_summary_file_writer(logdir,
- max_queue=None,
- flush_millis=None,
- filename_suffix=None,
- name=None):
+def create_file_writer(logdir,
+ max_queue=None,
+ flush_millis=None,
+ filename_suffix=None,
+ name=None):
"""Creates a summary file writer in the current context.
Args:
@@ -210,11 +212,11 @@ def create_summary_file_writer(logdir,
filename_suffix=filename_suffix)
-def create_summary_db_writer(db_uri,
- experiment_name=None,
- run_name=None,
- user_name=None,
- name=None):
+def create_db_writer(db_uri,
+ experiment_name=None,
+ run_name=None,
+ user_name=None,
+ name=None):
"""Creates a summary database writer in the current context.
This can be used to write tensors from the execution graph directly
@@ -498,7 +500,7 @@ _graph = graph # for functions with a graph parameter
def import_event(tensor, name=None):
"""Writes a @{tf.Event} binary proto.
- When using create_summary_db_writer(), this can be used alongside
+ When using create_db_writer(), this can be used alongside
@{tf.TFRecordReader} to load event logs into the database. Please
note that this is lower level than the other summary functions and
will ignore any conditions set by methods like
@@ -542,6 +544,13 @@ def eval_dir(model_dir, name=None):
return os.path.join(model_dir, "eval" if not name else "eval_" + name)
+def create_summary_file_writer(*args, **kwargs):
+ """Please use @{tf.contrib.summary.create_file_writer}."""
+ logging.warning("Deprecation Warning: create_summary_file_writer was renamed "
+ "to create_file_writer")
+ return create_file_writer(*args, **kwargs)
+
+
def _serialize_graph(arbitrary_graph):
if isinstance(arbitrary_graph, ops.Graph):
return arbitrary_graph.as_graph_def(add_shapes=True).SerializeToString()
diff --git a/tensorflow/contrib/summary/summary_ops_graph_test.py b/tensorflow/contrib/summary/summary_ops_graph_test.py
index 703adb7b46..f8da790188 100644
--- a/tensorflow/contrib/summary/summary_ops_graph_test.py
+++ b/tensorflow/contrib/summary/summary_ops_graph_test.py
@@ -48,7 +48,7 @@ class DbTest(summary_test_util.SummaryDbTest):
name = 'hi'
graph = graph_pb2.GraphDef(node=(node_def_pb2.NodeDef(name=name),))
with self.test_session():
- with self.create_summary_db_writer().as_default():
+ with self.create_db_writer().as_default():
summary_ops.initialize(graph=graph)
six.assertCountEqual(self, [name],
get_all(self.db, 'SELECT node_name FROM Nodes'))
@@ -57,7 +57,7 @@ class DbTest(summary_test_util.SummaryDbTest):
with ops.Graph().as_default(), self.test_session():
training_util.get_or_create_global_step()
logdir = tempfile.mkdtemp()
- with summary_ops.create_summary_file_writer(
+ with summary_ops.create_file_writer(
logdir, max_queue=0,
name='t2').as_default(), summary_ops.always_record_summaries():
summary_ops.initialize()
@@ -78,7 +78,7 @@ class DbTest(summary_test_util.SummaryDbTest):
with ops.Graph().as_default(), self.test_session():
training_util.get_or_create_global_step()
logdir = tempfile.mkdtemp()
- with summary_ops.create_summary_file_writer(
+ with summary_ops.create_file_writer(
logdir, max_queue=0,
name='t2').as_default(), summary_ops.always_record_summaries():
summary_ops.initialize()
diff --git a/tensorflow/contrib/summary/summary_ops_test.py b/tensorflow/contrib/summary/summary_ops_test.py
index 54433deb28..0b8e0b967c 100644
--- a/tensorflow/contrib/summary/summary_ops_test.py
+++ b/tensorflow/contrib/summary/summary_ops_test.py
@@ -44,7 +44,7 @@ class TargetTest(test_util.TensorFlowTestCase):
logdir = '/tmp/apath/that/doesnt/exist'
self.assertFalse(gfile.Exists(logdir))
with self.assertRaises(errors.NotFoundError):
- summary_ops.create_summary_file_writer(logdir, max_queue=0, name='t0')
+ summary_ops.create_file_writer(logdir, max_queue=0, name='t0')
def testShouldRecordSummary(self):
self.assertFalse(summary_ops.should_record_summaries())
@@ -54,7 +54,7 @@ class TargetTest(test_util.TensorFlowTestCase):
def testSummaryOps(self):
training_util.get_or_create_global_step()
logdir = tempfile.mkdtemp()
- with summary_ops.create_summary_file_writer(
+ with summary_ops.create_file_writer(
logdir, max_queue=0,
name='t0').as_default(), summary_ops.always_record_summaries():
summary_ops.generic('tensor', 1, '')
@@ -69,7 +69,7 @@ class TargetTest(test_util.TensorFlowTestCase):
def testDefunSummarys(self):
training_util.get_or_create_global_step()
logdir = tempfile.mkdtemp()
- with summary_ops.create_summary_file_writer(
+ with summary_ops.create_file_writer(
logdir, max_queue=0,
name='t1').as_default(), summary_ops.always_record_summaries():
@@ -85,7 +85,7 @@ class TargetTest(test_util.TensorFlowTestCase):
def testSummaryName(self):
training_util.get_or_create_global_step()
logdir = tempfile.mkdtemp()
- with summary_ops.create_summary_file_writer(
+ with summary_ops.create_file_writer(
logdir, max_queue=0,
name='t2').as_default(), summary_ops.always_record_summaries():
@@ -98,7 +98,7 @@ class TargetTest(test_util.TensorFlowTestCase):
def testSummaryGlobalStep(self):
step = training_util.get_or_create_global_step()
logdir = tempfile.mkdtemp()
- with summary_ops.create_summary_file_writer(
+ with summary_ops.create_file_writer(
logdir, max_queue=0,
name='t2').as_default(), summary_ops.always_record_summaries():
@@ -110,7 +110,7 @@ class TargetTest(test_util.TensorFlowTestCase):
def testMaxQueue(self):
logs = tempfile.mkdtemp()
- with summary_ops.create_summary_file_writer(
+ with summary_ops.create_file_writer(
logs, max_queue=2, flush_millis=999999,
name='lol').as_default(), summary_ops.always_record_summaries():
get_total = lambda: len(summary_test_util.events_from_logdir(logs))
@@ -123,7 +123,7 @@ class TargetTest(test_util.TensorFlowTestCase):
def testFlush(self):
logs = tempfile.mkdtemp()
- with summary_ops.create_summary_file_writer(
+ with summary_ops.create_file_writer(
logs, max_queue=999999, flush_millis=999999,
name='lol').as_default(), summary_ops.always_record_summaries():
get_total = lambda: len(summary_test_util.events_from_logdir(logs))
@@ -150,7 +150,7 @@ class DbTest(summary_test_util.SummaryDbTest):
return sum_
with summary_ops.always_record_summaries():
- with self.create_summary_db_writer().as_default():
+ with self.create_db_writer().as_default():
self.assertEqual(5, adder(int64(2), int64(3)).numpy())
six.assertCountEqual(self, [1, 1, 1],
@@ -162,7 +162,7 @@ class DbTest(summary_test_util.SummaryDbTest):
sum_id = get_one(self.db, 'SELECT tag_id FROM Tags WHERE tag_name = "sum"')
with summary_ops.always_record_summaries():
- with self.create_summary_db_writer().as_default():
+ with self.create_db_writer().as_default():
self.assertEqual(9, adder(int64(4), int64(5)).numpy())
six.assertCountEqual(self, [1, 1, 1, 2, 2, 2],
@@ -185,26 +185,26 @@ class DbTest(summary_test_util.SummaryDbTest):
def testBadExperimentName(self):
with self.assertRaises(ValueError):
- self.create_summary_db_writer(experiment_name='\0')
+ self.create_db_writer(experiment_name='\0')
def testBadRunName(self):
with self.assertRaises(ValueError):
- self.create_summary_db_writer(run_name='\0')
+ self.create_db_writer(run_name='\0')
def testBadUserName(self):
with self.assertRaises(ValueError):
- self.create_summary_db_writer(user_name='-hi')
+ self.create_db_writer(user_name='-hi')
with self.assertRaises(ValueError):
- self.create_summary_db_writer(user_name='hi-')
+ self.create_db_writer(user_name='hi-')
with self.assertRaises(ValueError):
- self.create_summary_db_writer(user_name='@')
+ self.create_db_writer(user_name='@')
def testGraphSummary(self):
training_util.get_or_create_global_step()
name = 'hi'
graph = graph_pb2.GraphDef(node=(node_def_pb2.NodeDef(name=name),))
with summary_ops.always_record_summaries():
- with self.create_summary_db_writer().as_default():
+ with self.create_db_writer().as_default():
summary_ops.graph(graph)
six.assertCountEqual(self, [name],
get_all(self.db, 'SELECT node_name FROM Nodes'))
diff --git a/tensorflow/contrib/summary/summary_test_internal.py b/tensorflow/contrib/summary/summary_test_internal.py
index 54233f2f50..80f60ae401 100644
--- a/tensorflow/contrib/summary/summary_test_internal.py
+++ b/tensorflow/contrib/summary/summary_test_internal.py
@@ -35,8 +35,8 @@ class SummaryDbTest(test_util.TensorFlowTestCase):
if os.path.exists(self.db_path):
os.unlink(self.db_path)
self.db = sqlite3.connect(self.db_path)
- self.create_summary_db_writer = functools.partial(
- summary_ops.create_summary_db_writer,
+ self.create_db_writer = functools.partial(
+ summary_ops.create_db_writer,
db_uri=self.db_path,
experiment_name='experiment',
run_name='run',
diff --git a/tensorflow/contrib/summary/summary_test_util.py b/tensorflow/contrib/summary/summary_test_util.py
index 915820e05b..bda57e6a0c 100644
--- a/tensorflow/contrib/summary/summary_test_util.py
+++ b/tensorflow/contrib/summary/summary_test_util.py
@@ -39,8 +39,8 @@ class SummaryDbTest(test_util.TensorFlowTestCase):
if os.path.exists(self.db_path):
os.unlink(self.db_path)
self.db = sqlite3.connect(self.db_path)
- self.create_summary_db_writer = functools.partial(
- summary_ops.create_summary_db_writer,
+ self.create_db_writer = functools.partial(
+ summary_ops.create_db_writer,
db_uri=self.db_path,
experiment_name='experiment',
run_name='run',