Suppressing Tensorflow Debugging Information
Tensorflow may display debugging information in the terminal upon initialization, including loaded libraries and discovered devices. While this information can be useful for debugging purposes, it can also clutter the console and make it difficult to track important messages.
To disable this debugging information, you can utilize the os.environ module:
<code class="python">import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' import tensorflow as tf</code>
This code sets the minimum logging level for Tensorflow to 3, effectively suppressing all debugging information.
The logging levels in Tensorflow range from 0 to 3, with 0 indicating all messages are printed and 3 indicating that only error messages are printed. Here's a breakdown of the logging levels:
Setting the minimum logging level to 3 ensures that no debugging information is displayed, regardless of the version of Tensorflow being used (tested with versions 0.12 and 1.0). This approach provides a clean and concise console output, allowing you to focus on essential messages.
The above is the detailed content of How to Suppress Tensorflow Debugging Output?. For more information, please follow other related articles on the PHP Chinese website!