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

Function TF_EnqueueNamedTensor

tensorflow/c/c_api_experimental.cc:252–298  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

250}
251
252void TF_EnqueueNamedTensor(TF_Session* session, int tensor_id,
253 TF_Tensor* tensor, TF_Status* status) {
254 assert(session);
255 {
256 tensorflow::mutex_lock c(session->graph->mu);
257 if (VLOG_IS_ON(1)) {
258 VLOG(1) << "Enqueuing named tensor with id " << tensor_id
259 << ", with input graph: "
260 << session->graph->graph.ToGraphDefDebug().DebugString();
261 tensorflow::Tensor internal_tensor;
262 if (tensorflow::TF_TensorToTensor(tensor, &internal_tensor).ok()) {
263 VLOG(1) << "Enqueu'ing tensor content: "
264 << internal_tensor.DebugString();
265 }
266 }
267 }
268
269 TF_Operation* enqueue_op = TF_GraphOperationByName(
270 session->graph,
271 tensorflow::strings::StrCat("fifo_queue_enqueue_", tensor_id).c_str());
272 if (enqueue_op == nullptr) {
273 status->status = tensorflow::errors::Internal(
274 "Unable to find the enqueue node in the TF graph.");
275 return;
276 }
277
278 TF_Operation* placeholder_op = TF_GraphOperationByName(
279 session->graph,
280 tensorflow::strings::StrCat("arg_tensor_enqueue_", tensor_id).c_str());
281 if (placeholder_op == nullptr) {
282 status->status = tensorflow::errors::Internal(
283 "Unable to find the placeholder node as input to enqueue in the TF "
284 "graph.");
285 return;
286 }
287
288 VLOG(1) << "Running the enqueue op";
289 TF_Output input{placeholder_op, 0};
290 TF_SessionRun(session, /*run_options*/ nullptr,
291 // input related parameters
292 /*inputs*/ &input, /*input_values*/ &tensor, /*ninputs*/ 1,
293 // output related parameters
294 /*outputs*/ nullptr, /*output_values*/ nullptr, /*noutputs*/ 0,
295 /*targets*/ &enqueue_op, /*ntargets*/ 1,
296 /*run_metadata*/ nullptr, status);
297 VLOG(1) << "Enqueuing is done.";
298}
299
300TF_Buffer* TFE_GetServerDef(const char* text_proto, TF_Status* status) {
301 tensorflow::ServerDef server_def;

Callers

nothing calls this directly

Calls 9

TF_TensorToTensorFunction · 0.85
TF_GraphOperationByNameFunction · 0.85
InternalFunction · 0.85
TF_SessionRunFunction · 0.85
ToGraphDefDebugMethod · 0.80
c_strMethod · 0.80
StrCatFunction · 0.50
DebugStringMethod · 0.45
okMethod · 0.45

Tested by

no test coverage detected