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

Method ComputeWithReader

tensorflow/core/kernels/reader_ops.cc:80–96  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78 using ReaderVerbAsyncOpKernel::ReaderVerbAsyncOpKernel;
79
80 void ComputeWithReader(OpKernelContext* context,
81 ReaderInterface* reader) override {
82 QueueInterface* queue;
83 OP_REQUIRES_OK(context,
84 GetResourceFromContext(context, "queue_handle", &queue));
85 core::ScopedUnref unref_me(queue);
86 Tensor* key = nullptr;
87 OP_REQUIRES_OK(context,
88 context->allocate_output("key", TensorShape({}), &key));
89 Tensor* value = nullptr;
90 OP_REQUIRES_OK(context,
91 context->allocate_output("value", TensorShape({}), &value));
92
93 auto key_scalar = key->scalar<string>();
94 auto value_scalar = value->scalar<string>();
95 reader->Read(queue, &key_scalar(), &value_scalar(), context);
96 }
97};
98
99REGISTER_KERNEL_BUILDER(Name("ReaderRead").Device(DEVICE_CPU), ReaderReadOp);

Callers

nothing calls this directly

Calls 4

GetResourceFromContextFunction · 0.85
allocate_outputMethod · 0.80
TensorShapeClass · 0.50
ReadMethod · 0.45

Tested by

no test coverage detected