aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/c/c_test_util.h
diff options
context:
space:
mode:
authorGravatar Asim Shankar <ashankar@google.com>2018-06-26 00:57:33 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-06-26 01:00:04 -0700
commiteb61daae91432be0b07bb2f6854887bedfa6fc95 (patch)
tree64b992ca3c2088d1dc52161e9182e1e881c947e7 /tensorflow/c/c_test_util.h
parent22c06a62b7dcc75f6f717cea63a947b21805afda (diff)
[C API]: Bugfix for TF_AddGradients.
TF_AddGradients could create nodes in the graph with names that conflicted with other nodes in the graph. This would most clearly happen if TF_AddGradients() was called twice on the same graph, and could also happen if there were other nodes in the graph that happened to have "gradients" as a prefix of their name. Fix that. The added test in c_api_test.cc would fail in the call to TF_SessionRun() with Node 'gradients/OnesLike' is not unique without the changes to c_api.cc and c_api_internal.h While at it, also fixed a possible name collision bug when using the C++ API to constructor graphs (using Scope). Thanks @karllessard for pointing this out. PiperOrigin-RevId: 202087996
Diffstat (limited to 'tensorflow/c/c_test_util.h')
-rw-r--r--tensorflow/c/c_test_util.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/tensorflow/c/c_test_util.h b/tensorflow/c/c_test_util.h
index c16aba666e..38313d647c 100644
--- a/tensorflow/c/c_test_util.h
+++ b/tensorflow/c/c_test_util.h
@@ -80,6 +80,9 @@ TF_Operation* Add(TF_Output l, TF_Output r, TF_Graph* graph, TF_Status* s,
TF_Operation* Min(TF_Operation* l, TF_Operation* r, TF_Graph* graph,
TF_Status* s, const char* name = "min");
+TF_Operation* Mul(TF_Operation* l, TF_Operation* r, TF_Graph* graph,
+ TF_Status* s, const char* name = "mul");
+
// If `op_device` is non-empty, set the created op on that device.
TF_Operation* MinWithDevice(TF_Operation* l, TF_Operation* r, TF_Graph* graph,
const string& op_device, TF_Status* s,