diff options
author | Yifei Feng <yifeif@google.com> | 2018-05-29 12:57:14 -0700 |
---|---|---|
committer | Yifei Feng <yifeif@google.com> | 2018-05-29 12:57:14 -0700 |
commit | 48d13f510b70e48b61a435011f78bfef4df55c9b (patch) | |
tree | fbf5d2505e3bf2aa8121053a16a8f74aa74ae018 /tensorflow/core/distributed_runtime/rpc | |
parent | baa794b4c02db5a5d4c115383564a271dd8f875d (diff) | |
parent | 7b5c87e20ccdd1b3194a517e2b7fbf11581293dd (diff) |
Merge commit for internal changes
Diffstat (limited to 'tensorflow/core/distributed_runtime/rpc')
-rw-r--r-- | tensorflow/core/distributed_runtime/rpc/BUILD | 16 | ||||
-rw-r--r-- | tensorflow/core/distributed_runtime/rpc/grpc_testlib_ops.cc | 85 |
2 files changed, 2 insertions, 99 deletions
diff --git a/tensorflow/core/distributed_runtime/rpc/BUILD b/tensorflow/core/distributed_runtime/rpc/BUILD index 40028ee241..4b2747f26d 100644 --- a/tensorflow/core/distributed_runtime/rpc/BUILD +++ b/tensorflow/core/distributed_runtime/rpc/BUILD @@ -314,18 +314,6 @@ tf_cc_binary( ], ) -tf_cuda_library( - name = "grpc_testlib_ops", - testonly = 1, - srcs = ["grpc_testlib_ops.cc"], - linkstatic = 1, # Seems to be needed since alwayslink is broken in bazel - deps = [ - "//tensorflow/core:framework", - "//tensorflow/core:lib", - ], - alwayslink = 1, -) - tf_cc_binary( name = "grpc_testlib_server", testonly = 1, @@ -334,11 +322,11 @@ tf_cc_binary( ], deps = [ ":grpc_server_lib", - ":grpc_testlib_ops", "//tensorflow/core:core_cpu", "//tensorflow/core:framework_internal", "//tensorflow/core:lib", "//tensorflow/core:protos_all_cc", + "//tensorflow/core:testlib", "//tensorflow/core/distributed_runtime:server_lib", "//tensorflow/core/kernels:constant_op", "//tensorflow/core/kernels:cwise_op", @@ -362,12 +350,12 @@ tf_cuda_library( visibility = ["//tensorflow:__subpackages__"], deps = [ ":grpc_session", - ":grpc_testlib_ops", "//tensorflow/core:core_cpu", "//tensorflow/core:framework", "//tensorflow/core:lib", "//tensorflow/core:protos_all_cc", "//tensorflow/core:test", + "//tensorflow/core:testlib", ], alwayslink = 1, ) diff --git a/tensorflow/core/distributed_runtime/rpc/grpc_testlib_ops.cc b/tensorflow/core/distributed_runtime/rpc/grpc_testlib_ops.cc deleted file mode 100644 index 5597ee7a76..0000000000 --- a/tensorflow/core/distributed_runtime/rpc/grpc_testlib_ops.cc +++ /dev/null @@ -1,85 +0,0 @@ -/* Copyright 2016 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -==============================================================================*/ - -#include "tensorflow/core/framework/op.h" -#include "tensorflow/core/framework/op_kernel.h" -#include "tensorflow/core/platform/macros.h" - -namespace tensorflow { -namespace test { - -// ErrorOp::Compute returns an error. -REGISTER_OP("Error").Input("in: T").Output("out: T").Attr("T: type").Attr( - "message: string"); -class ErrorOp : public OpKernel { - public: - explicit ErrorOp(OpKernelConstruction* ctx) : OpKernel(ctx) { - OP_REQUIRES_OK(ctx, ctx->GetAttr("message", &errmsg_)); - } - - void Compute(OpKernelContext* ctx) override { - ctx->SetStatus(errors::Internal(errmsg_)); - } - - private: - string errmsg_; -}; -REGISTER_KERNEL_BUILDER(Name("Error").Device(DEVICE_CPU), ErrorOp); - -REGISTER_OP("InvalidRefType") - .Output("out: Ref(TIn)") - .Attr("TIn: type") - .Attr("TOut: type"); -class InvalidRefType : public OpKernel { - public: - explicit InvalidRefType(OpKernelConstruction* ctx) : OpKernel(ctx) { - OP_REQUIRES_OK(ctx, ctx->GetAttr("TOut", &dtout_)); - output_ = Tensor(dtout_, TensorShape({})); - } - - void Compute(OpKernelContext* ctx) override { - ctx->set_output_ref(0, &mu_, &output_); - } - - private: - DataType dtout_; - mutex mu_; - Tensor output_; -}; -REGISTER_KERNEL_BUILDER(Name("InvalidRefType").Device(DEVICE_CPU), - InvalidRefType); - -// DelayOp::AsyncCompute sleeps for "micros"-econd and then returns -// its input. -REGISTER_OP("Delay").Input("in: T").Output("out: T").Attr("T: type").Attr( - "micros: int"); -class DelayOp : public AsyncOpKernel { - public: - explicit DelayOp(OpKernelConstruction* ctx) : AsyncOpKernel(ctx) { - OP_REQUIRES_OK(ctx, ctx->GetAttr("micros", µs_)); - } - - void ComputeAsync(OpKernelContext* ctx, DoneCallback done) override { - ctx->set_output(0, ctx->input(0)); - ctx->env()->SchedClosureAfter(micros_, done); - } - - private: - int64 micros_; -}; -REGISTER_KERNEL_BUILDER(Name("Delay").Device(DEVICE_CPU), DelayOp); - -} // namespace test -} // namespace tensorflow |