当前位置: 首页>>代码示例>>Python>>正文


Python logger.BaseBenchmarkLogger方法代码示例

本文整理汇总了Python中official.utils.logs.logger.BaseBenchmarkLogger方法的典型用法代码示例。如果您正苦于以下问题:Python logger.BaseBenchmarkLogger方法的具体用法?Python logger.BaseBenchmarkLogger怎么用?Python logger.BaseBenchmarkLogger使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在official.utils.logs.logger的用法示例。


在下文中一共展示了logger.BaseBenchmarkLogger方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from official.utils.logs import logger [as 别名]
# 或者: from official.utils.logs.logger import BaseBenchmarkLogger [as 别名]
def __init__(self,
               batch_size,
               every_n_steps=None,
               every_n_secs=None,
               warm_steps=0,
               metric_logger=None):
    """Initializer for ExamplesPerSecondHook.

    Args:
      batch_size: Total batch size across all workers used to calculate
        examples/second from global time.
      every_n_steps: Log stats every n steps.
      every_n_secs: Log stats every n seconds. Exactly one of the
        `every_n_steps` or `every_n_secs` should be set.
      warm_steps: The number of steps to be skipped before logging and running
        average calculation. warm_steps steps refers to global steps across all
        workers, not on each worker
      metric_logger: instance of `BenchmarkLogger`, the benchmark logger that
          hook should use to write the log. If None, BaseBenchmarkLogger will
          be used.

    Raises:
      ValueError: if neither `every_n_steps` or `every_n_secs` is set, or
      both are set.
    """

    if (every_n_steps is None) == (every_n_secs is None):
      raise ValueError("exactly one of every_n_steps"
                       " and every_n_secs should be provided.")

    self._logger = metric_logger or logger.BaseBenchmarkLogger()

    self._timer = tf.estimator.SecondOrStepTimer(
        every_steps=every_n_steps, every_secs=every_n_secs)

    self._step_train_time = 0
    self._total_steps = 0
    self._batch_size = batch_size
    self._warm_steps = warm_steps
    # List of examples per second logged every_n_steps.
    self.current_examples_per_sec_list = [] 
开发者ID:IntelAI,项目名称:models,代码行数:43,代码来源:hooks.py

示例2: test_get_default_benchmark_logger

# 需要导入模块: from official.utils.logs import logger [as 别名]
# 或者: from official.utils.logs.logger import BaseBenchmarkLogger [as 别名]
def test_get_default_benchmark_logger(self):
    with flagsaver.flagsaver(benchmark_logger_type="foo"):
      self.assertIsInstance(logger.get_benchmark_logger(),
                            logger.BaseBenchmarkLogger) 
开发者ID:IntelAI,项目名称:models,代码行数:6,代码来源:logger_test.py

示例3: test_config_base_benchmark_logger

# 需要导入模块: from official.utils.logs import logger [as 别名]
# 或者: from official.utils.logs.logger import BaseBenchmarkLogger [as 别名]
def test_config_base_benchmark_logger(self):
    with flagsaver.flagsaver(benchmark_logger_type="BaseBenchmarkLogger"):
      logger.config_benchmark_logger()
      self.assertIsInstance(logger.get_benchmark_logger(),
                            logger.BaseBenchmarkLogger) 
开发者ID:IntelAI,项目名称:models,代码行数:7,代码来源:logger_test.py

示例4: test_log_metric

# 需要导入模块: from official.utils.logs import logger [as 别名]
# 或者: from official.utils.logs.logger import BaseBenchmarkLogger [as 别名]
def test_log_metric(self):
    log = logger.BaseBenchmarkLogger()
    log.log_metric("accuracy", 0.999, global_step=1e4, extras={"name": "value"})

    expected_log_prefix = "Benchmark metric:"
    self.assertRegexpMatches(str(self.logged_message), expected_log_prefix) 
开发者ID:IntelAI,项目名称:models,代码行数:8,代码来源:logger_test.py

示例5: test_get_default_benchmark_logger

# 需要导入模块: from official.utils.logs import logger [as 别名]
# 或者: from official.utils.logs.logger import BaseBenchmarkLogger [as 别名]
def test_get_default_benchmark_logger(self):
    with flagsaver.flagsaver(benchmark_logger_type='foo'):
      self.assertIsInstance(logger.get_benchmark_logger(),
                            logger.BaseBenchmarkLogger) 
开发者ID:rockyzhengwu,项目名称:nsfw,代码行数:6,代码来源:logger_test.py

示例6: test_config_base_benchmark_logger

# 需要导入模块: from official.utils.logs import logger [as 别名]
# 或者: from official.utils.logs.logger import BaseBenchmarkLogger [as 别名]
def test_config_base_benchmark_logger(self):
    with flagsaver.flagsaver(benchmark_logger_type='BaseBenchmarkLogger'):
      logger.config_benchmark_logger()
      self.assertIsInstance(logger.get_benchmark_logger(),
                            logger.BaseBenchmarkLogger) 
开发者ID:rockyzhengwu,项目名称:nsfw,代码行数:7,代码来源:logger_test.py

示例7: test_get_default_benchmark_logger

# 需要导入模块: from official.utils.logs import logger [as 别名]
# 或者: from official.utils.logs.logger import BaseBenchmarkLogger [as 别名]
def test_get_default_benchmark_logger(self):
    self.assertIsInstance(logger.get_benchmark_logger(),
                          logger.BaseBenchmarkLogger) 
开发者ID:itsamitgoel,项目名称:Gun-Detector,代码行数:5,代码来源:logger_test.py

示例8: test_config_base_benchmark_logger

# 需要导入模块: from official.utils.logs import logger [as 别名]
# 或者: from official.utils.logs.logger import BaseBenchmarkLogger [as 别名]
def test_config_base_benchmark_logger(self):
    logger.config_benchmark_logger("")
    self.assertIsInstance(logger.get_benchmark_logger(),
                          logger.BaseBenchmarkLogger) 
开发者ID:itsamitgoel,项目名称:Gun-Detector,代码行数:6,代码来源:logger_test.py

示例9: __init__

# 需要导入模块: from official.utils.logs import logger [as 别名]
# 或者: from official.utils.logs.logger import BaseBenchmarkLogger [as 别名]
def __init__(self,
               batch_size,
               every_n_steps=None,
               every_n_secs=None,
               warm_steps=0,
               metric_logger=None):
    """Initializer for ExamplesPerSecondHook.

    Args:
      batch_size: Total batch size across all workers used to calculate
        examples/second from global time.
      every_n_steps: Log stats every n steps.
      every_n_secs: Log stats every n seconds. Exactly one of the
        `every_n_steps` or `every_n_secs` should be set.
      warm_steps: The number of steps to be skipped before logging and running
        average calculation. warm_steps steps refers to global steps across all
        workers, not on each worker
      metric_logger: instance of `BenchmarkLogger`, the benchmark logger that
          hook should use to write the log. If None, BaseBenchmarkLogger will
          be used.

    Raises:
      ValueError: if neither `every_n_steps` or `every_n_secs` is set, or
      both are set.
    """

    if (every_n_steps is None) == (every_n_secs is None):
      raise ValueError("exactly one of every_n_steps"
                       " and every_n_secs should be provided.")

    self._logger = metric_logger or logger.BaseBenchmarkLogger()

    self._timer = tf.train.SecondOrStepTimer(
        every_steps=every_n_steps, every_secs=every_n_secs)

    self._step_train_time = 0
    self._total_steps = 0
    self._batch_size = batch_size
    self._warm_steps = warm_steps 
开发者ID:GoogleCloudPlatform,项目名称:ml-on-gcp,代码行数:41,代码来源:hooks.py


注:本文中的official.utils.logs.logger.BaseBenchmarkLogger方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。