diff options
author | 2016-12-07 09:57:55 -0800 | |
---|---|---|
committer | 2016-12-07 10:05:48 -0800 | |
commit | db2a81a82c1753154648309f70f6ed3fa8f60837 (patch) | |
tree | 078e59f14062382856ac03f22d4fb7646c5e69f5 /tensorflow/core/common_runtime/direct_session.cc | |
parent | 3b99c7947a01cd85a6b551daff974f122ff5b1c8 (diff) |
Add a :debug BUILD target which, when linked into a binary, enables
DirectSession support for TensorFlow Debugger (tfdbg). Binaries that do not
want debugging support can avoid this dependency and its transitive deps. This
replaces the previous approach that was based on a preprocessor flag
(-DNOTFDBG).
Change: 141321165
Diffstat (limited to 'tensorflow/core/common_runtime/direct_session.cc')
-rw-r--r-- | tensorflow/core/common_runtime/direct_session.cc | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/tensorflow/core/common_runtime/direct_session.cc b/tensorflow/core/common_runtime/direct_session.cc index e1f2c55230..6052d57239 100644 --- a/tensorflow/core/common_runtime/direct_session.cc +++ b/tensorflow/core/common_runtime/direct_session.cc @@ -20,6 +20,7 @@ limitations under the License. #include <vector> #include "tensorflow/core/common_runtime/constant_folding.h" +#include "tensorflow/core/common_runtime/debugger_state_interface.h" #include "tensorflow/core/common_runtime/device_factory.h" #include "tensorflow/core/common_runtime/executor.h" #include "tensorflow/core/common_runtime/function.h" @@ -395,12 +396,10 @@ Status DirectSession::Run(const RunOptions& run_options, ExecutorsAndKeys* executors_and_keys; RunStateArgs run_state_args; -#ifndef NOTFDBG // EXPERIMENTAL: Options that allow the client to insert nodes into partition // graphs for debugging. - run_state_args.debugger_state.reset( - new DebuggerState(run_options.debug_tensor_watch_opts())); -#endif + run_state_args.debugger_state = + DebuggerStateRegistry::CreateState(run_options.debug_options()); TF_RETURN_IF_ERROR( GetOrCreateExecutors(pool, input_tensor_names, output_names, target_nodes, @@ -880,12 +879,10 @@ Status DirectSession::GetOrCreateExecutors( std::sort(tn_sorted.begin(), tn_sorted.end()); string debug_tensor_watches_summary; -#ifndef NOTFDBG if (run_state_args->debugger_state) { debug_tensor_watches_summary = run_state_args->debugger_state->SummarizeDebugTensorWatches(); } -#endif const string key = strings::StrCat( str_util::Join(inputs_sorted, ","), "->", str_util::Join(outputs_sorted, ","), "/", str_util::Join(tn_sorted, ","), @@ -985,12 +982,10 @@ Status DirectSession::GetOrCreateExecutors( optimizer.Optimize(lib, options_.env, device, &partition_graph); // EXPERIMENTAL: tfdbg inserts debug nodes (i.e., probes) to the graph -#ifndef NOTFDBG if (run_state_args->debugger_state) { TF_RETURN_IF_ERROR(run_state_args->debugger_state->InsertNodes( partition_graph, params.device)); } -#endif iter->second.reset(partition_graph); TF_RETURN_IF_ERROR(EnsureMemoryTypes(DeviceType(device->device_type()), |