提交 a746cee9 编写于 作者: D Dan Mané 提交者: TensorFlower Gardener

Tweak to EventAccumulator: Process new style summaries as floats.

Before this change, the EventAccumulator parses the new scalar_summaries as
a one-element np array like this: np.array(3, dtype=np.float32).

This is the same as a number wrt equality checking (i.e. expression above is
equal to 3.0), but it isn't json serializable, which causes problems for
TensorBoard.
Change: 136647129
上级 7e17e471
......@@ -342,7 +342,7 @@ class EventAccumulator(object):
return
if type_hint == 'scalar':
scalar = tensor_util.MakeNdarray(value.tensor)
scalar = float(tensor_util.MakeNdarray(value.tensor))
self._ProcessScalar(name, event.wall_time, event.step, scalar)
else:
LogErrorOnce(
......
......@@ -662,6 +662,8 @@ class MockingEventAccumulatorTest(EventAccumulatorTest):
self.assertEqual(accumulator.Scalars('scalar1'), seq1)
self.assertEqual(accumulator.Scalars('scalar2'), seq2)
first_value = accumulator.Scalars('scalar1')[0].value
self.assertTrue(isinstance(first_value, float))
def testTFSummaryImage(self):
"""Verify processing of tf.summary.image."""
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册