| 353 | } |
| 354 | |
| 355 | Status FileSliceRecvOp::RecvShape(OpKernelContext* ctx, |
| 356 | const FrameAndIter& frame_iter, |
| 357 | TensorShape& shape) { |
| 358 | Rendezvous::Args args; |
| 359 | args.device_context = ctx->op_device_context(); |
| 360 | args.alloc_attrs = AllocatorAttributes(); |
| 361 | if (ctx->is_eager()) { |
| 362 | // NOTE(fishx): Only set cancellation_manager in eager mode. Because in |
| 363 | // Tensorflow 1.x, session (or graph_mgr) will abort the underlying |
| 364 | // rendezvous if it encounters any error. |
| 365 | args.cancellation_manager = ctx->cancellation_manager(); |
| 366 | } |
| 367 | |
| 368 | Rendezvous::ParsedKey parsed_key; |
| 369 | slice_sendrecv::GetSliceRendezvousKey(key_prefix_, "_slice_transfer_shape", |
| 370 | frame_iter, &parsed_key.buf_); |
| 371 | VLOG(2) << "FileSliceRecv " << parsed_key.buf_; |
| 372 | TF_RETURN_IF_ERROR(Rendezvous::ParseKey(parsed_key.buf_, &parsed_key)); |
| 373 | |
| 374 | Tensor shape_t; |
| 375 | bool is_dead; |
| 376 | TF_RETURN_IF_ERROR(ctx->rendezvous()->Recv(parsed_key, args, &shape_t, |
| 377 | &is_dead, timeout_ms_)); |
| 378 | // This shouldn't be a dead tensor. |
| 379 | CHECK_EQ(is_dead, false); |
| 380 | auto shape_vec = shape_t.vec<int64>(); |
| 381 | const int64 num_elements = shape_t.NumElements(); |
| 382 | for (int64 i = 0; i < num_elements; i++) { |
| 383 | shape.AddDim(shape_vec(i)); |
| 384 | } |
| 385 | |
| 386 | return Status::OK(); |
| 387 | } |
| 388 | |
| 389 | Status FileSliceRecvOp::RecvElementBytes(OpKernelContext* ctx, |
| 390 | const FrameAndIter& frame_iter, |
nothing calls this directly
no test coverage detected