UPDATE (beyond 1.14): see my more thorough answer here (this is a dupe question anyway): https://stackoverflow.com/a/38645250/6557588
In addition to Wintro's answer, you can also disable/suppress TensorFlow logs from the C side (i.e. the uglier ones starting with single characters: I, E, etc.); the issue open regarding logging has been updated to state that you can now control logging via an environmental variable. You can now change the level by setting the environmental variable called TF_CPP_MIN_LOG_LEVEL
; it defaults to 0 (all logs shown), but can be set to 1 to filter out INFO
logs, 2 to additionally filter out WARNING
logs, and 3 to additionally filter out ERROR
logs. It appears to be in master now, and will likely be a part of future version (i.e. versions after r0.11). See this page for more information. Here is an example of changing the verbosity using Python:
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' # or any {'0', '1', '2'}
import tensorflow as tf
You can set this environmental variable in the environment that you run your script in. For example, with bash this can be in the file ~/.bashrc
, /etc/environment
, /etc/profile
, or in the actual shell as:
TF_CPP_MIN_LOG_LEVEL=2 python my_tf_script.py
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…