Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To turn off debugging information in Tensorflow, you can set the logging level to a higher level than the default DEBUG level. This can be done by adding the following line of code at the beginning of your script:

import logging
logging.getLogger('tensorflow').setLevel(logging.WARNING)

This sets the logging level of the 'tensorflow' logger to WARNING, which means that only messages of level WARNING and higher will be outputted to the console.

You can also set the logging level to ERROR, which will only output error messages to the console, or CRITICAL to only output critical messages.

Alternatively, you can set the environment variable TF_CPP_MIN_LOG_LEVEL to a specific value. The possible values are: - 0: default (output all messages) - 1: filter out INFO messages - 2: filter out INFO and WARNING messages - 3: filter out all messages except ERROR messages

For example, to set the logging level to ERROR, you can add the following line in your script or in the command prompt:

import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'

Note that setting the environment variable will affect all instances of Tensorflow running on your system, not just the one script or command prompt.