MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / RecvShape

Method RecvShape

tensorflow/core/kernels/file_slice_sendrecv_ops.cc:355–387  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

353}
354
355Status 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
389Status FileSliceRecvOp::RecvElementBytes(OpKernelContext* ctx,
390 const FrameAndIter& frame_iter,

Callers

nothing calls this directly

Calls 9

AllocatorAttributesClass · 0.85
GetSliceRendezvousKeyFunction · 0.85
is_eagerMethod · 0.80
rendezvousMethod · 0.80
op_device_contextMethod · 0.45
cancellation_managerMethod · 0.45
RecvMethod · 0.45
NumElementsMethod · 0.45
AddDimMethod · 0.45

Tested by

no test coverage detected