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:
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
import tensorflow as tf
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.
Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.
Copyright© 2022 湘ICP备2022001581号-3