aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/core/debug
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2018-01-30 10:05:04 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-01-30 12:27:47 -0800
commit7149a2e2e2f549035f23e21224ee41afe8df3876 (patch)
tree4fab32a87362e9708d07f388154a10ccb0c7800b /tensorflow/core/debug
parent88eb6c61ef7659c2b5bb1ec6586c7d3cca5e4e9c (diff)
Cleanup: Ran clang-format on files in tensorflow/core/.../*.{cc,h}.
PiperOrigin-RevId: 183848459
Diffstat (limited to 'tensorflow/core/debug')
-rw-r--r--tensorflow/core/debug/debug_gateway.cc53
-rw-r--r--tensorflow/core/debug/debug_gateway_test.cc32
-rw-r--r--tensorflow/core/debug/debug_grpc_testlib.cc2
-rw-r--r--tensorflow/core/debug/debug_io_utils_test.cc3
4 files changed, 46 insertions, 44 deletions
diff --git a/tensorflow/core/debug/debug_gateway.cc b/tensorflow/core/debug/debug_gateway.cc
index 616ced3d0f..2e1aabd1cc 100644
--- a/tensorflow/core/debug/debug_gateway.cc
+++ b/tensorflow/core/debug/debug_gateway.cc
@@ -24,31 +24,31 @@ limitations under the License.
namespace tensorflow {
DebugGateway::DebugGateway(DirectSession* session) : session_(session) {
- session_->node_outputs_callback_ = [this](
- const string& node_name, const int output_slot, const Tensor* tensor,
- const bool is_ref, OpKernelContext* ctx) {
- if (comp_cb_ != nullptr && output_slot <= 0) {
- // The node completion callback is invoked once for a node regardless
- // of whether the node has zero, one or more outputs.
- // The output_slot can be negative (-1, or kControlSlot) if
- // node_outputs_callback_ is invoked for a node with no output. If that
- // is the case, notify the callback that the node in question has no
- // output.
- comp_cb_(node_name, output_slot == 0);
- }
-
- // Copy tensor values (e.g., from GPU to host) only if the
- // value callback is not nullptr.
- if (val_cb_ != nullptr && output_slot >= 0) {
- CopyTensor(
- node_name, output_slot, tensor, ctx,
- [this, node_name, output_slot, is_ref](const Tensor* copied_tensor) {
- val_cb_(node_name, output_slot, *copied_tensor, is_ref);
- });
- }
-
- return Status::OK();
- };
+ session_->node_outputs_callback_ =
+ [this](const string& node_name, const int output_slot,
+ const Tensor* tensor, const bool is_ref, OpKernelContext* ctx) {
+ if (comp_cb_ != nullptr && output_slot <= 0) {
+ // The node completion callback is invoked once for a node regardless
+ // of whether the node has zero, one or more outputs.
+ // The output_slot can be negative (-1, or kControlSlot) if
+ // node_outputs_callback_ is invoked for a node with no output. If
+ // that is the case, notify the callback that the node in question has
+ // no output.
+ comp_cb_(node_name, output_slot == 0);
+ }
+
+ // Copy tensor values (e.g., from GPU to host) only if the
+ // value callback is not nullptr.
+ if (val_cb_ != nullptr && output_slot >= 0) {
+ CopyTensor(node_name, output_slot, tensor, ctx,
+ [this, node_name, output_slot,
+ is_ref](const Tensor* copied_tensor) {
+ val_cb_(node_name, output_slot, *copied_tensor, is_ref);
+ });
+ }
+
+ return Status::OK();
+ };
}
DebugGateway::~DebugGateway() {
@@ -86,7 +86,8 @@ void DebugGateway::CopyTensor(const string& node_name, const int output_slot,
// Determine if the tensor is on device (GPU) or host (CPU).
// The second part of the check is necessary because even an OpKernel on
// may have output tensors allocated on CPU.
- if ((device->name().find("GPU:") != string::npos || device->name().find("SYCL:") != string::npos) &&
+ if ((device->name().find("GPU:") != string::npos ||
+ device->name().find("SYCL:") != string::npos) &&
!ctx->output_alloc_attr(output_slot).on_host()) {
// GPU tensors: Copy it to host (CPU).
DeviceContext* device_ctxt = ctx->op_device_context();
diff --git a/tensorflow/core/debug/debug_gateway_test.cc b/tensorflow/core/debug/debug_gateway_test.cc
index 5758334906..b1bbd3f698 100644
--- a/tensorflow/core/debug/debug_gateway_test.cc
+++ b/tensorflow/core/debug/debug_gateway_test.cc
@@ -390,9 +390,9 @@ TEST_F(SessionDebugMinusAXTest,
debug_gateway.SetNodeValueCallback(
[this, &mu, &val_callback_count, &a_debug_identity_node_name,
&x_debug_identity_node_name, &y_debug_identity_node_name,
- &debug_identity_tensor_vals, &callbacks_done, &kConcurrentRuns](
- const string& node_name, const int output_slot,
- const Tensor& tensor_value, const bool is_ref) {
+ &debug_identity_tensor_vals, &callbacks_done,
+ &kConcurrentRuns](const string& node_name, const int output_slot,
+ const Tensor& tensor_value, const bool is_ref) {
mutex_lock l(mu);
if (node_name == a_debug_identity_node_name && output_slot == 0) {
@@ -560,21 +560,21 @@ TEST_F(SessionDebugOutputSlotWithoutOutgoingEdgeTest,
Notification callbacks_done;
std::vector<Tensor> debug_identity_tensor_vals;
- debug_gateway.SetNodeValueCallback([this, &mu, &callbacks_done,
- &debug_identity_node_name,
- &debug_identity_tensor_vals](
- const string& node_name, const int output_slot,
- const Tensor& tensor_value, const bool is_ref) {
- mutex_lock l(mu);
+ debug_gateway.SetNodeValueCallback(
+ [this, &mu, &callbacks_done, &debug_identity_node_name,
+ &debug_identity_tensor_vals](
+ const string& node_name, const int output_slot,
+ const Tensor& tensor_value, const bool is_ref) {
+ mutex_lock l(mu);
- if (node_name == debug_identity_node_name && output_slot == 0) {
- debug_identity_tensor_vals.push_back(tensor_value);
+ if (node_name == debug_identity_node_name && output_slot == 0) {
+ debug_identity_tensor_vals.push_back(tensor_value);
- if (!callbacks_done.HasBeenNotified()) {
- callbacks_done.Notify();
- }
- }
- });
+ if (!callbacks_done.HasBeenNotified()) {
+ callbacks_done.Notify();
+ }
+ }
+ });
// Add DebugIdentity watch on c:0, which does not have an outgoing edge.
RunOptions run_opts;
diff --git a/tensorflow/core/debug/debug_grpc_testlib.cc b/tensorflow/core/debug/debug_grpc_testlib.cc
index a312f789d8..f70931e926 100644
--- a/tensorflow/core/debug/debug_grpc_testlib.cc
+++ b/tensorflow/core/debug/debug_grpc_testlib.cc
@@ -30,7 +30,7 @@ namespace test {
::grpc::Status TestEventListenerImpl::SendEvents(
::grpc::ServerContext* context,
- ::grpc::ServerReaderWriter< ::tensorflow::EventReply, ::tensorflow::Event>*
+ ::grpc::ServerReaderWriter<::tensorflow::EventReply, ::tensorflow::Event>*
stream) {
Event event;
diff --git a/tensorflow/core/debug/debug_io_utils_test.cc b/tensorflow/core/debug/debug_io_utils_test.cc
index 2f83c2415b..0807a85b8b 100644
--- a/tensorflow/core/debug/debug_io_utils_test.cc
+++ b/tensorflow/core/debug/debug_io_utils_test.cc
@@ -57,7 +57,8 @@ class DebugIOUtilsTest : public ::testing::Test {
TEST_F(DebugIOUtilsTest, ConstructDebugNodeKey) {
DebugNodeKey debug_node_key("/job:worker/replica:1/task:0/device:GPU:2",
"hidden_1/MatMul", 0, "DebugIdentity");
- EXPECT_EQ("/job:worker/replica:1/task:0/device:GPU:2", debug_node_key.device_name);
+ EXPECT_EQ("/job:worker/replica:1/task:0/device:GPU:2",
+ debug_node_key.device_name);
EXPECT_EQ("hidden_1/MatMul", debug_node_key.node_name);
EXPECT_EQ(0, debug_node_key.output_slot);
EXPECT_EQ("DebugIdentity", debug_node_key.debug_op);