How to Suppress TensorFlow Debugging Information
TensorFlow users may encounter extraneous console messages regarding loaded libraries and available devices. These messages can be intrusive, especially in production environments or when debugging Python code.
Solution: Disable Debugging Information
To disable this debugging information, set the TF_CPP_MIN_LOG_LEVEL environment variable:
<code class="python">import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' import tensorflow as tf</code>
Explanation:
The TF_CPP_MIN_LOG_LEVEL environment variable controls the minimum severity level of messages that are printed. By setting it to '3', all messages with severity level less than 3 (i.e., INFO, WARNING, and ERROR) are suppressed.
Log Level Hierarchy:
This solution has been tested and confirmed to work with TensorFlow versions 0.12 and 1.0.
The above is the detailed content of How to Silence TensorFlow Debugging Messages?. For more information, please follow other related articles on the PHP Chinese website!