STT-tensorflow/tensorflow/python/debug
Stephan Lee a5d38592ce Change API contract for the private add_function_callback and allow graph edits before finalizing a func_graph.
Currently, function_callbacks were invoked after the graphs were finalized, primarily used to prevent dereferencing. While the API seemingly allow graph edits, they are futile as the graph is already committed to the C++.

With this change, we change the semantics of the API a little bit and explicitly allows graph edits.

PiperOrigin-RevId: 355877980
Change-Id: If43e37d2fb1032085048b7810aa4e387714e2f88
2021-02-05 10:30:49 -08:00
..
cli [tfdbg] Mark the reasons for a number of tests decorated with run_v1_only 2020-10-12 13:09:48 -07:00
examples Update Keras training logic for detecting whether an input dataset is shuffled. 2020-09-16 14:29:00 -07:00
lib Change API contract for the private add_function_callback and allow graph edits before finalizing a func_graph. 2021-02-05 10:30:49 -08:00
wrappers [tfdbg] Mark the reasons for a number of tests decorated with run_v1_only 2020-10-12 13:09:48 -07:00
__init__.py Replace instances of "blacklist" with "denylist" where possible. See Google Developer guidelines at https://developers.google.com/style/word-list#blacklist for more information. 2020-07-20 16:05:25 -07:00
BUILD PY2 removal cleanup 2021-01-20 17:11:44 -08:00
README.md

TensorFlow Debugger (TFDBG)

[TOC]

TensorFlow Debugger (TFDBG) is a specialized debugger for TensorFlow's computation graphs. It provides access to internal graph structures and tensor values at TensorFlow runtime.

Why TFDBG?

In TensorFlow's current computation-graph framework, almost all actual computation after graph construction happens in a single Python function, namely tf.Session.run. Basic Python debugging tools such as pdb cannot be used to debug Session.run, due to the fact that TensorFlow's graph execution happens in the underlying C++ layer. C++ debugging tools such as gdb are not ideal either, because of their inability to recognize and organize the stack frames and variables in a way relevant to TensorFlow's operations, tensors and other graph constructs.

TFDBG addresses these limitations. Among the features provided by TFDBG, the following ones are designed to facilitate runtime debugging of TensorFlow models:

  • Easy access through session wrappers
  • Easy integration with common high-level APIs, such as TensorFlow Estimators and Keras
  • Inspection of runtime tensor values and node connections
  • Conditional breaking after runs that generate tensors satisfying given predicates, which makes common debugging tasks such as tracing the origin of infinities and NaNs easier
  • Association of nodes and tensors in graphs with Python source lines
  • Profiling of models at the level of graph nodes and Python source lines. (Omitted internal-only feature)
  • A gRPC-based remote debugging protocol, which allows us to build a browser-based graphical user interface (GUI) for TFDBG: the TensorBoard Debugger Plugin.

How to use TFDBG?