aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/core/framework/selective_registration.h
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2016-10-07 20:49:32 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2016-10-07 22:02:47 -0700
commit3510b3060abef6b99fe4bc0656d8dc9406d6c46d (patch)
treef4e98689ef2640a5b7a33c72b9ec5d4db39a7f08 /tensorflow/core/framework/selective_registration.h
parentb361824ae7e04ce6cabf5d4f2e0924aa19dd24de (diff)
Automated rollback of change 135516295
Change: 135548182
Diffstat (limited to 'tensorflow/core/framework/selective_registration.h')
-rw-r--r--tensorflow/core/framework/selective_registration.h29
1 files changed, 11 insertions, 18 deletions
diff --git a/tensorflow/core/framework/selective_registration.h b/tensorflow/core/framework/selective_registration.h
index fae83282ed..751e2cde84 100644
--- a/tensorflow/core/framework/selective_registration.h
+++ b/tensorflow/core/framework/selective_registration.h
@@ -35,27 +35,20 @@ limitations under the License.
// for a tool that can be used to generate ops_to_register.h.
#include "ops_to_register.h"
-// ops_to_register should define macros for:
-//
-// SHOULD_REGISTER_OP_KERNEL(clz)
-// SHOULD_REGISTER_OP(op)
-// SHOULD_REGISTER_OP_GRADIENT
-// # same as SHOULD_REGISTER_OP, but invoked from a non-constexpr location.
-// SHOULD_REGISTER_OP_NON_CONSTEXPR(op)
-//
-// Except for SHOULD_REGISTER_OP_NON_CONSTEXPR, the macros should be defined
-// using constexprs. See selective_registration_util.h for some utilities that
-// can be used.
-#if (!defined(SHOULD_REGISTER_OP_KERNEL) || !defined(SHOULD_REGISTER_OP) || \
- !defined(SHOULD_REGISTER_OP_GRADIENT) || \
- !defined(SHOULD_REGISTER_OP_NON_CONSTEXPR))
-static_assert(false, "ops_to_register.h must define SHOULD_REGISTER macros");
-#endif
+// Op kernel classes for which ShouldRegisterOpKernel returns false will not be
+// registered.
+#define SHOULD_REGISTER_OP_KERNEL(clz) \
+ (strstr(kNecessaryOpKernelClasses, "," clz ",") != nullptr)
+
+// Ops for which ShouldRegisterOp returns false will not be registered.
+#define SHOULD_REGISTER_OP(op) ShouldRegisterOp(op)
+
+// If kRequiresSymbolicGradients is false, then no gradient ops are registered.
+#define SHOULD_REGISTER_OP_GRADIENT kRequiresSymbolicGradients
#else
-#define SHOULD_REGISTER_OP_KERNEL(clz) true
+#define SHOULD_REGISTER_OP_KERNEL(filename) true
#define SHOULD_REGISTER_OP(op) true
-#define SHOULD_REGISTER_OP_NON_CONSTEXPR(op) true
#define SHOULD_REGISTER_OP_GRADIENT true
#endif