| 338 | "/job:localhost/replica:0/task:0/device:CPU:0"; |
| 339 | |
| 340 | static 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 | |
| 370 | static void createTFEEnqueue(TFE_Context* ctx, TF_DataType inputType, |
| 371 | TFE_TensorHandle* queue, TFE_TensorHandle* tensor, |
no test coverage detected