Controlling TensorFlow Debug Information in Terminals
When working with TensorFlow, various debugging information is displayed in the terminal, including details about loaded libraries and detected devices. While this information can be useful for debugging, it may become overwhelming or distracting. To address this, TensorFlow provides a mechanism for customizing the level of debugging information logged.
Disable Debugging Information
To disable all debugging information, set the TF_CPP_MIN_LOG_LEVEL environment variable to 3. This will suppress all informational messages from TensorFlow.
<code class="python">import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' import tensorflow as tf</code>
Log Level Customization
The TF_CPP_MIN_LOG_LEVEL variable allows for finer control over the logging level. The following values represent different logging levels:
Example
The following example demonstrates how to suppress all non-error messages:
<code class="python">os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' import tensorflow as tf</code>
Tested Versions
This solution has been tested on TensorFlow versions 0.12 and 1.0.
The above is the detailed content of How to Control TensorFlow Debugging Output in Your Terminal?. For more information, please follow other related articles on the PHP Chinese website!