Ask Your Question
0

How can one turn off the debugging information in Tensorflow?

asked 2021-04-26 11:00:00 +0000

djk gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2022-06-28 22:00:00 +0000

ladyg gravatar image

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.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2021-04-26 11:00:00 +0000

Seen: 17 times

Last updated: Jun 28 '22