Skip to content

Commit 2da2ae7

Browse files
Dan Manétensorflower-gardener
authored andcommitted
Add summary test verifying that the new summary ops play nicely with variables.
No core code change. Change: 136782838
1 parent dd84514 commit 2da2ae7

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

tensorflow/python/summary/summary_test.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,21 @@ def testScalarSummary(self):
4040
self.assertEqual(values[0].tag, 'outer/inner')
4141
self.assertEqual(values[0].simple_value, 3.0)
4242

43+
def testSummarizingVariable(self):
44+
with self.test_session() as s:
45+
c = tf.constant(42.0)
46+
v = tf.Variable(c)
47+
ss = tf.summary.scalar('summary', v)
48+
init = tf.initialize_all_variables()
49+
s.run(init)
50+
summ_str = s.run(ss)
51+
summary = tf.Summary()
52+
summary.ParseFromString(summ_str)
53+
self.assertEqual(len(summary.value), 1)
54+
value = summary.value[0]
55+
self.assertEqual(value.tag, 'summary')
56+
self.assertEqual(value.simple_value, 42.0)
57+
4358
def testImageSummary(self):
4459
with self.test_session() as s:
4560
i = tf.ones((5, 4, 4, 3))

0 commit comments

Comments
 (0)