tf.debugging.experimental.enable_dump_debug_info
Stay organized with collections
Save and categorize content based on your preferences.
Enable dumping debugging information from a TensorFlow program.
tf.debugging.experimental.enable_dump_debug_info(
dump_root, tensor_debug_mode=DEFAULT_TENSOR_DEBUG_MODE,
circular_buffer_size=1000, op_regex=None, tensor_dtypes=None
)
The debugging information is dumped to a directory on the file system
specified as dump_root
.
The dumped debugging information can be ingested by debugger UIs.
The files in the dump directory contain the following information:
- TensorFlow Function construction (e.g., compilation of Python functions
decorated with @tf.function), the op types, names (if available), context,
the input and output tensors, and the associated stack traces.
- Execution of TensorFlow operations (ops) and Functions and their stack
traces, op types, names (if available) and contexts. In addition,
depending on the value of the
tensor_debug_mode
argument (see Args
section below), the value(s) of the output tensors or more concise
summaries of the tensor values will be dumped.
- A snapshot of Python source files involved in the execution of the
TensorFlow program.
Once enabled, the dumping can be disabled with the corresponding
disable_dump_debug_info()
method under the same Python namespace.
Calling this method more than once with the same dump_root
is idempotent.
Calling this method more than once with different tensor_debug_mode
s
leads to a ValueError
.
Calling this method more than once with different circular_buffer_size
s
leads to a ValueError
.
Calling this method with a different dump_root
abolishes the
previously-enabled dump_root
.
Usage example:
tf.debugging.experimental.enable_dump_debug_info('/tmp/my-tfdbg-dumps')
# Code to build, train and run your TensorFlow model...
Args |
dump_root
|
The directory path where the dumping information will be written.
|
tensor_debug_mode
|
Debug mode for tensor values, as a string.
The currently supported options are:
- "NO_TENSOR": (Default) Only traces the execution of ops' output
tensors, while not dumping the value of the ops' output tensors
or any form of concise summary of them.
|
circular_buffer_size
|
Size of the circular buffers for execution events.
These circular buffers are designed to reduce the overhead of debugging
dumping. They hold the most recent debug events concerning eager execution
of ops and tf.function s and traces of tensor values computed inside
tf.function s. They are written to the file system only when the proper
flushing method is called (see description of return values below).
Expected to be an integer. If <= 0, the circular-buffer behavior will be
disabled, i.e., the execution debug events will be written to the file
writers in the same way as non-execution events such as op creations and
source-file snapshots.
|
op_regex
|
Dump data from only the tensors from op types that matches to the
regular expression (through Python's re.match() ).
"Op type" refers to the names of the TensorFlow operations (e.g.,
"MatMul", "LogSoftmax"), which may repeat in a TensorFlow
function. It does not refer to the names of nodes (e.g.,
"dense/MatMul", "dense_1/MatMul_1") which are unique within a function.
Example 1: Dump tensor data from only MatMul and Relu ops
op_regex="^(MatMul|Relu)$" .
Example 2: Dump tensors from all ops except Relu:
op_regex="(?!^Relu$)" .
This filter operates in a logical AND relation with tensor_dtypes .
|
tensor_dtypes
|
Dump data from only the tensors of which the specified
dtypes. This optional argument can be in any of the following format:
a list or tuple of DType objects or strings that can be converted
to DType objects via tf.as_dtype() . Examples:
tensor_dtype=[tf.float32, tf.float64] ,
tensor_dtype=["float32", "float64"] ,
tensor_dtypes=(tf.int32, tf.bool) ,
tensor_dtypes=("int32", "bool")
a callable that takes a single DType argument and returns a Python
boolean indicating whether the dtype is to be included in the data
dumping. Examples:
tensor_dtype=lambda dtype: dtype.is_integer .
This filter operates in a logical AND relation with op_regex .
|
Returns |
A DebugEventsWriter instance used by the dumping callback. The caller
may use its flushing methods, including FlushNonExecutionFiles() and
FlushExecutionFiles() .
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2020-10-01 UTC.
[null,null,["Last updated 2020-10-01 UTC."],[],[],null,["# tf.debugging.experimental.enable_dump_debug_info\n\n|-----------------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.2.0/tensorflow/python/debug/lib/dumping_callback.py#L646-L807) |\n\nEnable dumping debugging information from a TensorFlow program.\n\n#### View aliases\n\n\n**Compat aliases for migration**\n\nSee\n[Migration guide](https://www.tensorflow.org/guide/migrate) for\nmore details.\n\n[`tf.compat.v1.debugging.experimental.enable_dump_debug_info`](/api_docs/python/tf/debugging/experimental/enable_dump_debug_info)\n\n\u003cbr /\u003e\n\n tf.debugging.experimental.enable_dump_debug_info(\n dump_root, tensor_debug_mode=DEFAULT_TENSOR_DEBUG_MODE,\n circular_buffer_size=1000, op_regex=None, tensor_dtypes=None\n )\n\nThe debugging information is dumped to a directory on the file system\nspecified as `dump_root`.\n\nThe dumped debugging information can be ingested by debugger UIs.\n\nThe files in the dump directory contain the following information:\n\n- TensorFlow Function construction (e.g., compilation of Python functions decorated with @tf.function), the op types, names (if available), context, the input and output tensors, and the associated stack traces.\n- Execution of TensorFlow operations (ops) and Functions and their stack traces, op types, names (if available) and contexts. In addition, depending on the value of the `tensor_debug_mode` argument (see Args section below), the value(s) of the output tensors or more concise summaries of the tensor values will be dumped.\n- A snapshot of Python source files involved in the execution of the TensorFlow program.\n\nOnce enabled, the dumping can be disabled with the corresponding\n`disable_dump_debug_info()` method under the same Python namespace.\nCalling this method more than once with the same `dump_root` is idempotent.\nCalling this method more than once with different `tensor_debug_mode`s\nleads to a `ValueError`.\nCalling this method more than once with different `circular_buffer_size`s\nleads to a `ValueError`.\nCalling this method with a different `dump_root` abolishes the\npreviously-enabled `dump_root`.\n\n#### Usage example:\n\n tf.debugging.experimental.enable_dump_debug_info('/tmp/my-tfdbg-dumps')\n\n # Code to build, train and run your TensorFlow model...\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `dump_root` | The directory path where the dumping information will be written. |\n| `tensor_debug_mode` | Debug mode for tensor values, as a string. The currently supported options are: \u003cbr /\u003e - \"NO_TENSOR\": (Default) Only traces the execution of ops' output tensors, while not dumping the value of the ops' output tensors or any form of concise summary of them. |\n| `circular_buffer_size` | Size of the circular buffers for execution events. These circular buffers are designed to reduce the overhead of debugging dumping. They hold the most recent debug events concerning eager execution of ops and [`tf.function`](../../../tf/function)s and traces of tensor values computed inside [`tf.function`](../../../tf/function)s. They are written to the file system only when the proper flushing method is called (see description of return values below). Expected to be an integer. If \\\u003c= 0, the circular-buffer behavior will be disabled, i.e., the execution debug events will be written to the file writers in the same way as non-execution events such as op creations and source-file snapshots. |\n| `op_regex` | Dump data from only the tensors from op types that matches to the regular expression (through Python's `re.match()`). \"Op type\" refers to the names of the TensorFlow operations (e.g., \"MatMul\", \"LogSoftmax\"), which may repeat in a TensorFlow function. It does *not* refer to the names of nodes (e.g., \"dense/MatMul\", \"dense_1/MatMul_1\") which are unique within a function. - Example 1: Dump tensor data from only MatMul and Relu ops `op_regex=\"^(MatMul|Relu)$\"`. - Example 2: Dump tensors from all ops *except* Relu: `op_regex=\"(?!^Relu$)\"`. This filter operates in a logical AND relation with `tensor_dtypes`. |\n| `tensor_dtypes` | Dump data from only the tensors of which the specified dtypes. This optional argument can be in any of the following format: - a list or tuple of `DType` objects or strings that can be converted to `DType` objects via [`tf.as_dtype()`](../../../tf/dtypes/as_dtype). Examples: - `tensor_dtype=[tf.float32, tf.float64]`, - `tensor_dtype=[\"float32\", \"float64\"]`, - `tensor_dtypes=(tf.int32, tf.bool)`, - `tensor_dtypes=(\"int32\", \"bool\")` - a callable that takes a single `DType` argument and returns a Python `boolean` indicating whether the dtype is to be included in the data dumping. Examples: - `tensor_dtype=lambda dtype: dtype.is_integer`. This filter operates in a logical AND relation with `op_regex`. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| A DebugEventsWriter instance used by the dumping callback. The caller may use its flushing methods, including `FlushNonExecutionFiles()` and `FlushExecutionFiles()`. ||\n\n\u003cbr /\u003e"]]