Suppression of Tensorflow Debugging Output
Tensorflow prints extensive information about loaded libraries, found devices, and other debugging data during its initialization phase. While this output can be valuable for troubleshooting, it can also be overwhelming and distract from other log messages. This article explores how to disable this debugging information.
To suppress the display of debugging logs, a simple yet effective solution exists. By setting the environment variable TF_CPP_MIN_LOG_LEVEL to the appropriate value, the level of logging can be controlled.
<code class="python">import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' import tensorflow as tf</code>
Tested with Tensorflow versions 0.12 and 1.0, setting the environment variable to 3 effectively disables all debugging output, leaving only critical errors and warnings.
For finer control over the logging behavior, different levels can be set:
The above is the detailed content of How to Silence TensorFlow\'s Debugging Output?. For more information, please follow other related articles on the PHP Chinese website!