| 69 | }; |
| 70 | |
| 71 | TEST_F(RemoteMgrTest, LocalTensorHandle) { |
| 72 | TestRemoteMgr remote_mgr(true, ctx_); |
| 73 | Tensor t(DT_FLOAT, TensorShape({0})); |
| 74 | |
| 75 | TensorHandle* handle; |
| 76 | TF_ASSERT_OK(TensorHandle::CreateLocalHandle(t, &handle)); |
| 77 | EXPECT_EQ(nullptr, handle->device()); |
| 78 | EXPECT_EQ(local_device_, handle->DeviceOrHostCPU(ctx_)); |
| 79 | const uint64 op_id = remote_mgr.OpId(); |
| 80 | EXPECT_EQ(1, op_id); |
| 81 | RemoteTensorHandle remote_handle; |
| 82 | TF_ASSERT_OK(remote_mgr.SerializeRemoteTensorHandle( |
| 83 | handle, &remote_handle, handle->device(), |
| 84 | handle->DeviceOrHostCPU(ctx_)->name())); |
| 85 | EXPECT_EQ(2, remote_mgr.OpId()); |
| 86 | EXPECT_EQ(op_id, remote_handle.op_id()); |
| 87 | EXPECT_EQ(0, remote_handle.output_num()); |
| 88 | EXPECT_EQ(local_device_->name(), remote_handle.device()); |
| 89 | |
| 90 | TensorHandle* deserialized_handle; |
| 91 | TF_ASSERT_OK(remote_mgr.DeserializeRemoteTensorHandle(remote_handle, |
| 92 | &deserialized_handle)); |
| 93 | tensorflow::TensorHandle* h; |
| 94 | TF_EXPECT_OK(remote_mgr.GetTensorHandle( |
| 95 | RemoteTensorHandleInternal(remote_handle), &h)); |
| 96 | TF_ASSERT_OK( |
| 97 | remote_mgr.DeleteTensorHandle(RemoteTensorHandleInternal(remote_handle))); |
| 98 | EXPECT_FALSE( |
| 99 | remote_mgr.GetTensorHandle(RemoteTensorHandleInternal(remote_handle), &h) |
| 100 | .ok()); |
| 101 | |
| 102 | deserialized_handle->Unref(); |
| 103 | handle->Unref(); |
| 104 | } |
| 105 | |
| 106 | TEST_F(RemoteMgrTest, SerializeLocalTensorHandleWithRemoteMirror) { |
| 107 | RemoteMgr remote_mgr(false, ctx_); |
nothing calls this directly
no test coverage detected