diff options
Diffstat (limited to 'tensorflow/python/client/test_construction_fails_op.cc')
-rw-r--r-- | tensorflow/python/client/test_construction_fails_op.cc | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tensorflow/python/client/test_construction_fails_op.cc b/tensorflow/python/client/test_construction_fails_op.cc new file mode 100644 index 0000000000..47b2b5b49c --- /dev/null +++ b/tensorflow/python/client/test_construction_fails_op.cc @@ -0,0 +1,22 @@ +#include "tensorflow/core/framework/op.h" +#include "tensorflow/core/framework/op_kernel.h" +#include "tensorflow/core/public/status.h" + +namespace tensorflow { + +REGISTER_OP("ConstructionFails"); + +class ConstructionFailsOp : public OpKernel { + public: + explicit ConstructionFailsOp(OpKernelConstruction* ctx) : OpKernel(ctx) { + OP_REQUIRES(ctx, false, + errors::InvalidArgument("Failure during construction.")); + } + + void Compute(OpKernelContext* ctx) override {} +}; + +REGISTER_KERNEL_BUILDER(Name("ConstructionFails").Device(DEVICE_CPU), + ConstructionFailsOp); + +} // end namespace tensorflow |