aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/cc/framework/cc_op_gen.cc
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2017-01-27 08:26:49 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2017-01-27 08:45:49 -0800
commit54b2180f996d69ca6558cdc07939a5887ba52d80 (patch)
tree971375d79344f63504276d0d905f272dc491d37b /tensorflow/cc/framework/cc_op_gen.cc
parent38532a511073460035a101fffeb857ca2bfc0c05 (diff)
Skip generating code for deprecated ops in C++.
Change: 145797840
Diffstat (limited to 'tensorflow/cc/framework/cc_op_gen.cc')
-rw-r--r--tensorflow/cc/framework/cc_op_gen.cc32
1 files changed, 20 insertions, 12 deletions
diff --git a/tensorflow/cc/framework/cc_op_gen.cc b/tensorflow/cc/framework/cc_op_gen.cc
index a4da3aa8e2..2efa82b3b4 100644
--- a/tensorflow/cc/framework/cc_op_gen.cc
+++ b/tensorflow/cc/framework/cc_op_gen.cc
@@ -27,6 +27,7 @@ limitations under the License.
#include "tensorflow/core/platform/env.h"
#include "tensorflow/core/platform/logging.h"
#include "tensorflow/core/platform/types.h"
+#include "tensorflow/core/public/version.h"
namespace tensorflow {
@@ -388,18 +389,20 @@ OpInfo::OpInfo(const OpDef& op_def) : op_def(op_def) {
arg_types.push_back("const ::tensorflow::Scope&");
arg_names.push_back("scope");
- if (op_def.summary().empty()) {
+ if (op_def.has_deprecation()) {
+ if (!op_def.summary().empty()) {
+ comment = strings::StrCat(op_def.summary(), "\n");
+ }
+ strings::StrAppend(&comment, "DEPRECATED at GraphDef version ",
+ op_def.deprecation().version(), ":\n",
+ op_def.deprecation().explanation(), ".\n");
+ } else if (op_def.summary().empty()) {
comment = "TODO: add doc.\n";
} else {
comment = strings::StrCat(op_def.summary(), "\n");
- if (op_def.has_deprecation()) {
- strings::StrAppend(&comment, "\nDEPRECATED at GraphDef version ",
- op_def.deprecation().version(), ":\n",
- op_def.deprecation().explanation(), ".\n");
- }
- if (!op_def.description().empty()) {
- strings::StrAppend(&comment, "\n", op_def.description(), "\n");
- }
+ }
+ if (!op_def.description().empty()) {
+ strings::StrAppend(&comment, "\n", op_def.description(), "\n");
}
strings::StrAppend(&comment, "\nArguments:\n* scope: A Scope object\n");
@@ -794,11 +797,16 @@ namespace ops {
TF_CHECK_OK(cc->Append(cc_header));
for (const auto& op_def : ops.op()) {
- if (op_def.name() == "Const") {
- // We use a hand-written wrapper for "Const", since the
- // generated code depends on it.
+ // Skip deprecated ops.
+ // TODO(josh11b): If needed, can put them into a "deprecated" namespace
+ // instead of skipping.
+ if (op_def.has_deprecation() &&
+ op_def.deprecation().version() <= TF_GRAPH_DEF_VERSION) {
continue;
}
+ // We use a hand-written wrapper for "Const", since the generated
+ // code depends on it.
+ if (op_def.name() == "Const") continue;
WriteCCOp(op_def, h.get(), cc.get());
}