aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/cc/framework
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2018-03-05 14:45:28 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-03-05 14:49:23 -0800
commit5279cf29cea96b3ec50df506bb51d8ffabdabac9 (patch)
tree2a19ffcb78e2fc3836d08a63287d367a5da6c88b /tensorflow/cc/framework
parent06c7a190ac122512edf7229041f34391d8993da0 (diff)
Correct op::Attr usage in C++ gradient implementations.
Also enabled TF_MUST_USE_RESULT for the generated Attr API, so we can catch any new errors early. Fixes #17360 PiperOrigin-RevId: 187925761
Diffstat (limited to 'tensorflow/cc/framework')
-rw-r--r--tensorflow/cc/framework/cc_op_gen.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/tensorflow/cc/framework/cc_op_gen.cc b/tensorflow/cc/framework/cc_op_gen.cc
index a40ad1ffc3..39893f5ccd 100644
--- a/tensorflow/cc/framework/cc_op_gen.cc
+++ b/tensorflow/cc/framework/cc_op_gen.cc
@@ -697,7 +697,8 @@ string OpInfo::GetOpAttrStruct() const {
attr_comment = MakeComment(attr_comment, " ");
strings::StrAppend(&setters, attr_comment);
- strings::StrAppend(&setters, " Attrs ", attr_func_def, " x) {\n");
+ strings::StrAppend(&setters, " TF_MUST_USE_RESULT Attrs ", attr_func_def,
+ " x) {\n");
strings::StrAppend(&setters, " Attrs ret = *this;\n");
strings::StrAppend(&setters, " ret.", api_def_attr.rename_to(),
"_ = x;\n");