• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python stats_ops.latency_stats函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python combinations.combine函数代码示例发布时间:2022-05-27
下一篇:
Python prefetching_ops.copy_to_device函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap