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

Function createTFEQueue

tensorflow/c/c_api_experimental.cc:340–368  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

338 "/job:localhost/replica:0/task:0/device:CPU:0";
339
340static TFE_TensorHandle* createTFEQueue(TFE_Context* ctx, TF_DataType inputType,
341 int tensor_id, TF_Status* status) {
342 std::unique_ptr<TFE_Op, decltype(&TFE_DeleteOp)> queueOp(
343 TFE_NewOp(ctx, "FIFOQueueV2", status), TFE_DeleteOp);
344 TFE_OpSetDevice(queueOp.get(), DEFAULT_CPU_DEVICE, status);
345 if (!status->status.ok()) return nullptr;
346 // TODO: use NAMED_TENSOR_QUEUE_CAPACITY in S4TF compiler.
347 TFE_OpSetAttrInt(queueOp.get(), "capacity", 1);
348 TFE_OpSetAttrTypeList(queueOp.get(), "component_types", &inputType, 1);
349 auto shared_name = tensorflow::strings::StrCat("fifo_queue_", tensor_id);
350 TFE_OpSetAttrString(queueOp.get(), "shared_name", shared_name.data(),
351 shared_name.size());
352 TFE_OpSetAttrString(queueOp.get(), "container", "", 0);
353
354 // TODO: consider making this an unknown shape.
355 const int64_t* dims_ptr = nullptr;
356 int num_dims = 0;
357 TFE_OpSetAttrShapeList(queueOp.get(), "shapes", &dims_ptr, &num_dims,
358 /*num_values*/ 0, status);
359 if (!status->status.ok()) return nullptr;
360
361 int num_retvals = 1;
362 TFE_TensorHandle* queue = nullptr;
363 TFE_Execute(queueOp.get(), &queue, &num_retvals, status);
364 if (!status->status.ok()) return nullptr;
365 CHECK_EQ(num_retvals, 1);
366
367 return queue;
368}
369
370static void createTFEEnqueue(TFE_Context* ctx, TF_DataType inputType,
371 TFE_TensorHandle* queue, TFE_TensorHandle* tensor,

Callers 6

TFE_DequeueNamedTensorFunction · 0.85
TFE_EnqueueNamedTensorFunction · 0.85
TFE_EnqueueVariantTensorFunction · 0.85
TFE_DequeueVariantTensorFunction · 0.85

Calls 12

TFE_NewOpFunction · 0.85
TFE_OpSetDeviceFunction · 0.85
TFE_OpSetAttrIntFunction · 0.85
TFE_OpSetAttrTypeListFunction · 0.85
TFE_OpSetAttrStringFunction · 0.85
TFE_OpSetAttrShapeListFunction · 0.85
TFE_ExecuteFunction · 0.85
StrCatFunction · 0.50
getMethod · 0.45
okMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected