當前位置: 首頁>>代碼示例>>Python>>正文


Python event_pb2.LogMessage方法代碼示例

本文整理匯總了Python中tensorflow.core.util.event_pb2.LogMessage方法的典型用法代碼示例。如果您正苦於以下問題:Python event_pb2.LogMessage方法的具體用法?Python event_pb2.LogMessage怎麽用?Python event_pb2.LogMessage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在tensorflow.core.util.event_pb2的用法示例。


在下文中一共展示了event_pb2.LogMessage方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: log

# 需要導入模塊: from tensorflow.core.util import event_pb2 [as 別名]
# 或者: from tensorflow.core.util.event_pb2 import LogMessage [as 別名]
def log(level, message, *args):
  """Conditionally logs `message % args` at the level `level`.

  Note that tensorboard_logging verbosity and logging verbosity are separate;
  the message will always be passed through to the logging module regardless of
  whether it passes the tensorboard_logging verbosity check.

  Args:
    level: The verbosity level to use. Must be one of
      tensorboard_logging.{DEBUG, INFO, WARN, ERROR, FATAL}.
    message: The message template to use.
    *args: Arguments to interpolate to the message template, if any.

  Raises:
    ValueError: If `level` is not a valid logging level.
    RuntimeError: If the `SummaryWriter` to use has not been set.
  """
  if _summary_writer is _sentinel_summary_writer:
    raise RuntimeError('Must call set_summary_writer before doing any '
                       'logging from tensorboard_logging')
  _check_verbosity(level)
  proto_level = _LEVEL_PROTO_MAP[level]
  if proto_level >= _LEVEL_PROTO_MAP[_verbosity]:
    log_message = event_pb2.LogMessage(level=proto_level,
                                       message=message % args)
    event = event_pb2.Event(wall_time=time.time(), log_message=log_message)

    if _summary_writer:
      _summary_writer.add_event(event)

  logging.log(_PLATFORM_LOGGING_LEVEL_MAP[level], message, *args) 
開發者ID:ryfeus,項目名稱:lambda-packs,代碼行數:33,代碼來源:tensorboard_logging.py


注:本文中的tensorflow.core.util.event_pb2.LogMessage方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。