Tensorflow学习碎片1:设置 TensorFlow 的 Log 输出级别

本文介绍了TensorFlow日志的四个级别:INFO、WARNING、ERROR和FATAL,并说明了如何设置日志输出级别,特别是如何通过设置基础级别来过滤不同严重程度的信息。默认情况下,设置为'0'将输出所有信息,而设置为'3'则只会显示ERROR和FATAL级别的日志。
摘要由CSDN通过智能技术生成
import os
os.environ["TF_CPP_MIN_LOG_LEVEL"]='1'  #显示所有信息(默认)
os.environ["TF_CPP_MIN_LOG_LEVEL"]='2'  #只显示 Warning 和 Error
os.environ["TF_CPP_MIN_LOG_LEVEL"]='3'  #只显示 Error

例如

python
Python 2.7.15+ (default, Jul  9 2019, 16:51:35) 
[GCC 7.4.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.environ['TF_CPP_MIN_LEVEL']='2'
>>> import tensorflow as tf
>>> hello = tf.constant('Hello, Tensorflow!')
>>> sess = tf.Session()
2019-09-16 11:39:04.539840: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
2019-09-16 11:39:04.543861: I tensorflow/core/platform/profile_utils
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值