tensorflowログメッセージ---- tf.logging

1. tensorflowログはじめに

TensorFlowは、ログメッセージの5つのレベルを使用しています。昇順、彼らはDEBUGINFOWARNERRORFATALあなたはこれらのレベルの構成ログのいずれかで記録すると、TensorFlow出力すべてのログメッセージは、そのレベルとすべてのログよりもレベル以上に対応します。たとえば、エラーログレベルが設定されている、あなたは、ログ出力を受信すると、設定されたDEBUGレベルは、5つの段階からすべてのログメッセージを取得する場合は致命的なエラーメッセージは、含まれている場合。デフォルトでは、Tensorflowでのレベルの構成をロギングWARNが、モデルのトレーニングを追跡する場合、あなたは進行中の他の操作のためのフィードバックを提供しますレベルINFOを、調整する必要があります。

2. tf.logging.set_verbosity()

ログメッセージが記録されるため、しきい値を設定します。Pythonは対応するログlevelパラメータ

# 设置日志级别,此时显示大于等于INFO级别的日志
tf.logging.set_verbosity(tf.logging.INFO)

3.ロギング

tf.logging.info("hellow,word")              # 记录一条info级别的日志
tf.logging.debug("hellow,word")
tf.logging.warn("helllow, word")
tf.logging.error("hellow, word")
tf.logging.fatal("hellow, word")

例4

4.1デフォルトのデフォルトの下では、Tensorflowは、ログレベルを設定することがWARN

import tensorflow as tf
tf.logging.info("hellow word, info level")
tf.logging.debug("hellow word, debug level")
tf.logging.warn("hellow word, warn level")
tf.logging.error("hellow word, error level")
tf.logging.fatal("hellow word, fatal level")

輸出

W0208 12:12:14.905251 90696 test.py:5] hellow word, warn level
E0208 12:12:14.905251 90696 test.py:6] hellow word, error level
E0208 12:12:14.906248 90696 test.py:7] CRITICAL - hellow word, fatal level
[Finished in 49.2s]

4.2設定レベルのログ

情報出力レベル以上のログに等しいです

import tensorflow as tf
tf.logging.set_verbosity(tf.logging.INFO)
tf.logging.info("hellow word, info level")
tf.logging.debug("hellow word, debug level")
tf.logging.warn("hellow word, warn level")
tf.logging.error("hellow word, error level")
tf.logging.fatal("hellow word, fatal level")

輸出

I0208 12:15:57.261396 69356 test.py:3] hellow word, info level
W0208 12:15:57.261396 69356 test.py:5] hellow word, warn level
E0208 12:15:57.261396 69356 test.py:6] hellow word, error level
E0208 12:15:57.261396 69356 test.py:7] CRITICAL - hellow word, fatal level

5.その他の事項

5.1 tf.logging.info(MSG、* argsを、**引数)

パラメータは、argsそのようなものとして使用MSGプレースホルダであります

tf.logging.info("now %d epochs on %s ", 100, "test.py")

輸出

I0208 12:36:35.534926 86200 test.py:3] now 100 epochs on test.py 
公開された33元の記事 ウォンの賞賛1 ビュー2608

おすすめ

転載: blog.csdn.net/orangerfun/article/details/104220977