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