Join us at TensorFlow World, Oct 28-31. Use code TF20 for 20% off select passes. Register now


TensorFlow 2.0 version View source on GitHub

Sets the AutoGraph verbosity level.


  • tf.compat.v1.autograph.set_verbosity
  • tf.compat.v2.autograph.set_verbosity

Debug logging in AutoGraph

More verbose logging is useful to enable when filing bug reports or doing more in-depth debugging.

There are two controls that control the logging verbosity:

  • The set_verbosity function

  • The AUTOGRAPH_VERBOSITY environment variable

set_verbosity takes precedence over the environment variable.

For example:

import os
import tensorflow as tf

os.environ['AUTOGRAPH_VERBOSITY'] = 5
# Verbosity is now 5

# Verbosity is now 0

os.environ['AUTOGRAPH_VERBOSITY'] = 1
# No effect, because set_verbosity was already called.

Logs entries are output to absl's default output, with INFO level. Logs can be mirrored to stdout by using the alsologtostdout argument. Mirroring is enabled by default when Python runs in interactive mode.


  • level: int, the verbosity level; larger values specify increased verbosity; 0 means no logging. When reporting bugs, it is recommended to set this value to a larges number, like 10.
  • alsologtostdout: bool, whether to also output log messages to sys.stdout.