本文整理汇总了Python中tensorflow.contrib.data.python.ops.stats_ops.latency_stats函数的典型用法代码示例。如果您正苦于以下问题:Python latency_stats函数的具体用法?Python latency_stats怎么用?Python latency_stats使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了latency_stats函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_latency_stats_invalid_tag_shape
def test_latency_stats_invalid_tag_shape(self):
with self.assertRaisesRegexp(
ValueError, 'Shape must be rank 0 but is rank 1'):
self.run_core_tests(
lambda: dataset_ops.Dataset.range(100).apply(
stats_ops.latency_stats(["record_latency", "record_latency_2"])),
None, 100)
开发者ID:tejas-kale,项目名称:tensorflow,代码行数:7,代码来源:stats_dataset_ops_test.py
示例2: testRepeatedTags
def testRepeatedTags(self):
stats_aggregator = stats_ops.StatsAggregator()
dataset = dataset_ops.Dataset.range(100).apply(
stats_ops.latency_stats("record_latency")).apply(
stats_ops.latency_stats("record_latency")).apply(
stats_ops.set_stats_aggregator(stats_aggregator))
iterator = dataset.make_initializable_iterator()
next_element = iterator.get_next()
summary_t = stats_aggregator.get_summary()
with self.test_session() as sess:
sess.run(iterator.initializer)
for i in range(100):
self.assertEqual(i, sess.run(next_element))
self._assertSummaryHasCount(
sess.run(summary_t), "record_latency", float(2 * (i + 1)))
with self.assertRaises(errors.OutOfRangeError):
sess.run(next_element)
self._assertSummaryHasCount(sess.run(summary_t), "record_latency", 200.0)
开发者ID:ZhangXinNan,项目名称:tensorflow,代码行数:19,代码来源:stats_dataset_ops_test.py
示例3: testNoAggregatorRegistered
def testNoAggregatorRegistered(self):
dataset = dataset_ops.Dataset.range(100).apply(
stats_ops.latency_stats("record_latency"))
iterator = dataset.make_initializable_iterator()
next_element = iterator.get_next()
with self.test_session() as sess:
sess.run(iterator.initializer)
for i in range(100):
self.assertEqual(i, sess.run(next_element))
with self.assertRaises(errors.OutOfRangeError):
sess.run(next_element)
开发者ID:ZhangXinNan,项目名称:tensorflow,代码行数:12,代码来源:stats_dataset_ops_test.py
示例4: testMultipleStatsAggregatorsSameIteratorFail
def testMultipleStatsAggregatorsSameIteratorFail(self):
dataset = dataset_ops.Dataset.range(100).apply(
stats_ops.latency_stats("record_latency"))
iterator = dataset.make_initializable_iterator()
stats_aggregator_0 = stats_ops.StatsAggregator()
stats_aggregator_1 = stats_ops.StatsAggregator()
with self.test_session() as sess:
sess.run(stats_aggregator_0.subscribe(iterator))
# TODO(mrry): Consider making this allowable (and also allowing
# aggregators to unsubscribe).
with self.assertRaises(errors.FailedPreconditionError):
sess.run(stats_aggregator_1.subscribe(iterator))
开发者ID:Kongsea,项目名称:tensorflow,代码行数:13,代码来源:stats_dataset_ops_test.py
示例5: testMultipleTags
def testMultipleTags(self):
dataset = dataset_ops.Dataset.range(100).apply(
stats_ops.latency_stats("record_latency")).apply(
stats_ops.latency_stats("record_latency_2"))
iterator = dataset.make_initializable_iterator()
stats_aggregator = stats_ops.StatsAggregator()
stats_aggregator_subscriber = stats_aggregator.subscribe(iterator)
next_element = iterator.get_next()
summary_t = stats_aggregator.get_summary()
with self.test_session() as sess:
sess.run([iterator.initializer, stats_aggregator_subscriber])
for i in range(100):
self.assertEqual(i, sess.run(next_element))
self._assertSummaryHasCount(
sess.run(summary_t), "record_latency", float(i + 1))
self._assertSummaryHasCount(
sess.run(summary_t), "record_latency_2", float(i + 1))
with self.assertRaises(errors.OutOfRangeError):
sess.run(next_element)
self._assertSummaryHasCount(sess.run(summary_t), "record_latency", 100.0)
self._assertSummaryHasCount(
sess.run(summary_t), "record_latency_2", 100.0)
开发者ID:Kongsea,项目名称:tensorflow,代码行数:23,代码来源:stats_dataset_ops_test.py
示例6: testMultipleIteratorsSameAggregator
def testMultipleIteratorsSameAggregator(self):
stats_aggregator = stats_ops.StatsAggregator()
dataset = dataset_ops.Dataset.range(100).apply(
stats_ops.latency_stats("record_latency")).apply(
stats_ops.set_stats_aggregator(stats_aggregator))
iterator_0 = dataset.make_initializable_iterator()
iterator_1 = dataset.make_initializable_iterator()
next_element = iterator_0.get_next() + iterator_1.get_next()
summary_t = stats_aggregator.get_summary()
with self.cached_session() as sess:
sess.run([iterator_0.initializer, iterator_1.initializer])
for i in range(100):
self.assertEqual(i * 2, sess.run(next_element))
self._assertSummaryHasCount(
sess.run(summary_t), "record_latency", float(2 * (i + 1)))
with self.assertRaises(errors.OutOfRangeError):
sess.run(next_element)
self._assertSummaryHasCount(sess.run(summary_t), "record_latency", 200.0)
开发者ID:HughKu,项目名称:tensorflow,代码行数:19,代码来源:stats_dataset_ops_test.py
示例7: _build_dataset_multiple_tags
def _build_dataset_multiple_tags(self,
num_elements,
tag1="record_latency",
tag2="record_latency_2"):
return dataset_ops.Dataset.range(num_elements).apply(
stats_ops.latency_stats(tag1)).apply(stats_ops.latency_stats(tag2))
开发者ID:Jordan1237,项目名称:tensorflow,代码行数:6,代码来源:stats_dataset_serialization_test.py
示例8: _build_dataset_latency_stats
def _build_dataset_latency_stats(self, num_elements, tag="record_latency"):
return dataset_ops.Dataset.range(num_elements).apply(
stats_ops.latency_stats(tag))
开发者ID:Jordan1237,项目名称:tensorflow,代码行数:3,代码来源:stats_dataset_serialization_test.py
注:本文中的tensorflow.contrib.data.python.ops.stats_ops.latency_stats函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论