class tfdbg.DebugDumpDir
See the guide: TensorFlow Debugger > Classes for debug-dump data and directories
Data set from a debug-dump directory on filesystem.
An instance of DebugDumpDir
contains all DebugTensorDatum
instances in a tfdbg dump root directory.
dumped_tensor_data
run_feed_keys_info
Get a str representation of the feed_dict used in the Session.run() call.
If the information is available, a str
obtained from repr(feed_dict)
. If the information is not available, None
.
run_fetches_info
Get a str representation of the fetches used in the Session.run() call.
If the information is available, a str
obtained from repr(fetches)
. If the information is not available, None
.
size
Total number of dumped tensors in the dump root directory.
(int
) total number of dumped tensors in the dump root directory.
t0
Absolute timestamp of the first dumped tensor.
(int
) absolute timestamp of the first dumped tensor, in microseconds.
__init__(dump_root, partition_graphs=None, validate=True)
DebugDumpDir
constructor.
dump_root
: (str
) path to the dump root directory.partition_graphs
: A repeated field of GraphDefs representing the partition graphs executed by the TensorFlow runtime.validate
: (bool
) whether the dump files are to be validated against the partition graphs.IOError
: If dump_root does not exist as a directory.debug_watch_keys(node_name)
Get all tensor watch keys of given node according to partition graphs.
node_name
: (str
) name of the node.(list
of str
) all debug tensor watch keys. Returns an empty list if the node name does not correspond to any debug watch keys.
LookupError
: If debug watch information has not been loaded from partition graphs yet.
devices()
Get the list of devices.
(list
of str
) names of the devices.
LookupError
: If node inputs and control inputs have not been loaded from partition graphs yet.find(predicate, first_n=0)
Find dumped tensor data by a certain predicate.
predicate
: A callable that takes two input arguments:
python def predicate(debug_tensor_datum, tensor): # returns a bool
where debug_tensor_datum
is an instance of DebugTensorDatum
, which carries the metadata, such as the Tensor
's node name, output slot timestamp, debug op name, etc.; and tensor
is the dumped tensor value as a numpy.ndarray
. * first_n
: (int
) return only the first n DebugTensotDatum
instances (in time order) for which the predicate returns True. To return all the DebugTensotDatum
instances, let first_n be <= 0.
A list of all DebugTensorDatum
objects in this DebugDumpDir
object for which predicate returns True, sorted in ascending order of the timestamp.
get_dump_sizes_bytes(node_name, output_slot, debug_op)
Get the sizes of the dump files for a debug-dumped tensor.
Unit of the file size: byte.
node_name
: (str
) name of the node that the tensor is produced by.output_slot
: (int
) output slot index of tensor.debug_op
: (str
) name of the debug op.(list
of int
): list of dump file sizes in bytes.
ValueError
: If the tensor watch key does not exist in the debug dump data.get_rel_timestamps(node_name, output_slot, debug_op)
Get the relative timestamp from for a debug-dumped tensor.
Relative timestamp means (absolute timestamp - t0
), where t0
is the absolute timestamp of the first dumped tensor in the dump root. The tensor may be dumped multiple times in the dump root directory, so a list of relative timestamps (numpy.ndarray
) is returned.
node_name
: (str
) name of the node that the tensor is produced by.output_slot
: (int
) output slot index of tensor.debug_op
: (str
) name of the debug op.(list
of int
) list of relative timestamps.
ValueError
: If the tensor watch key does not exist in the debug dump data.get_tensor_file_paths(node_name, output_slot, debug_op)
Get the file paths from a debug-dumped tensor.
node_name
: (str
) name of the node that the tensor is produced by.output_slot
: (int
) output slot index of tensor.debug_op
: (str
) name of the debug op.List of file path(s) loaded. This is a list because each debugged tensor may be dumped multiple times.
ValueError
: If the tensor does not exist in the debug-dump data.get_tensors(node_name, output_slot, debug_op)
Get the tensor value from for a debug-dumped tensor.
The tensor may be dumped multiple times in the dump root directory, so a list of tensors (numpy.ndarray
) is returned.
node_name
: (str
) name of the node that the tensor is produced by.output_slot
: (int
) output slot index of tensor.debug_op
: (str
) name of the debug op.List of tensors (numpy.ndarray
) loaded from the debug-dump file(s).
ValueError
: If the tensor does not exist in the debug-dump data.loaded_partition_graphs()
Test whether partition graphs have been loaded.
node_attributes(node_name)
Get the attributes of a node.
node_name
: Name of the node in question.Attributes of the node.
LookupError
: If no partition graphs have been loaded.ValueError
: If no node named node_name exists.node_device(node_name)
Get the device of a node.
node_name
: (str
) name of the node.(str
) name of the device on which the node is placed.
LookupError
: If node inputs and control inputs have not been loaded from partition graphs yet.ValueError
: If the node does not exist in partition graphs.node_exists(node_name)
Test if a node exists in the partition graphs.
node_name
: (str
) name of the node to be checked.A boolean indicating whether the node exists.
LookupError
: If no partition graphs have been loaded yet.node_inputs(node_name, is_control=False)
Get the inputs of given node according to partition graphs.
node_name
: Name of the node.is_control
: (bool
) Whether control inputs, rather than non-control inputs, are to be returned.(list
of str
) inputs to the node, as a list of node names.
LookupError
: If node inputs and control inputs have not been loaded from partition graphs yet.ValueError
: If the node does not exist in partition graphs.node_op_type(node_name)
Get the op type of given node.
node_name
: (str
) name of the node.(str
) op type of the node.
LookupError
: If node op types have not been loaded from partition graphs yet.ValueError
: If the node does not exist in partition graphs.node_recipients(node_name, is_control=False)
Get recipient of the given node's output according to partition graphs.
node_name
: (str
) name of the node.is_control
: (bool
) whether control outputs, rather than non-control outputs, are to be returned.(list
of str
) all inputs to the node, as a list of node names.
LookupError
: If node inputs and control inputs have not been loaded from partition graphs yet.ValueError
: If the node does not exist in partition graphs.node_traceback(element_name)
Try to retrieve the Python traceback of node's construction.
element_name
: (str
) Name of a graph element (node or tensor).(list) The traceback list object as returned by the extract_trace
method of Python's traceback module.
LookupError
: If Python graph is not available for traceback lookup.KeyError
: If the node cannot be found in the Python graph loaded.nodes()
Get a list of all nodes from the partition graphs.
All nodes' names, as a list of str.
LookupError
: If no partition graphs have been loaded.partition_graphs()
Get the partition graphs.
Partition graphs as repeated fields of GraphDef.
LookupError
: If no partition graphs have been loaded.set_python_graph(python_graph)
Provide Python Graph
object to the wrapper.
Unlike the partition graphs, which are protobuf GraphDef
objects, Graph
is a Python object and carries additional information such as the traceback of the construction of the nodes in the graph.
python_graph
: (ops.Graph) The Python Graph object.transitive_inputs(node_name, include_control=True)
Get the transitive inputs of given node according to partition graphs.
node_name
: Name of the nodeinclude_control
: Include control inputs (True by default).(list
of str
) all transitive inputs to the node, as a list of node names.
LookupError
: If node inputs and control inputs have not been loaded from partition graphs yet.ValueError
: If the node does not exist in partition graphs.watch_key_to_data(debug_watch_key)
Get all DebugTensorDatum
instances corresponding to a debug watch key.
debug_watch_key
: (str
) debug watch key.A list of DebugTensorDatum
instances that correspond to the debug watch key. If the watch key does not exist, returns an empty list.
ValueError
: If the debug watch key does not exist.Defined in tensorflow/python/debug/lib/debug_data.py
.
© 2017 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/api_docs/python/tfdbg/DebugDumpDir