def testSessionLogStartMessageDiscardsExpiredEvents(self):
"""Test that SessionLog.START message discards expired events.
This discard logic is preferred over the out-of-order step discard logic,
but this logic can only be used for event protos which have the SessionLog
enum, which was introduced to event.proto for file_version >= brain.Event:2.
"""
gen = _EventGenerator(self)
acc = ea.EventAccumulator(gen)
gen.AddEvent(tf.Event(wall_time=0, step=1, file_version='brain.Event:2'))
gen.AddScalarTensor('s1', wall_time=1, step=100, value=20)
gen.AddScalarTensor('s1', wall_time=1, step=200, value=20)
gen.AddScalarTensor('s1', wall_time=1, step=300, value=20)
gen.AddScalarTensor('s1', wall_time=1, step=400, value=20)
gen.AddScalarTensor('s2', wall_time=1, step=202, value=20)
gen.AddScalarTensor('s2', wall_time=1, step=203, value=20)
slog = tf.SessionLog(status=tf.SessionLog.START)
gen.AddEvent(tf.Event(wall_time=2, step=201, session_log=slog))
acc.Reload()
self.assertEqual([x.step for x in acc.Tensors('s1')], [100, 200])
self.assertEqual([x.step for x in acc.Tensors('s2')], [])
plugin_event_accumulator_test.py 文件源码
python
阅读 27
收藏 0
点赞 0
评论 0
评论列表
文章目录