| 211 | } |
| 212 | |
| 213 | TF_Tensor* TF_DequeueNamedTensor(TF_Session* session, int tensor_id, |
| 214 | TF_Status* status) { |
| 215 | assert(session); |
| 216 | { |
| 217 | tensorflow::mutex_lock c(session->graph->mu); |
| 218 | VLOG(1) << "Dequeuing named tensor with id " << tensor_id |
| 219 | << ", with input graph: " |
| 220 | << session->graph->graph.ToGraphDefDebug().DebugString(); |
| 221 | } |
| 222 | |
| 223 | TF_Operation* dequeue_op = TF_GraphOperationByName( |
| 224 | session->graph, |
| 225 | tensorflow::strings::StrCat("fifo_queue_dequeue_", tensor_id).c_str()); |
| 226 | if (dequeue_op == nullptr) { |
| 227 | status->status = tensorflow::errors::Internal( |
| 228 | "Unable to find the dequeue node in the TF graph."); |
| 229 | return nullptr; |
| 230 | } |
| 231 | |
| 232 | VLOG(1) << "Running the dequeue op"; |
| 233 | TF_Output output{dequeue_op, 0}; |
| 234 | TF_Tensor* ret; |
| 235 | TF_SessionRun(session, /*run_options*/ nullptr, |
| 236 | // input related parameters |
| 237 | /*inputs*/ nullptr, /*input_values*/ nullptr, /*ninputs*/ 0, |
| 238 | // output related parameters |
| 239 | /*outputs*/ &output, /*output_values*/ &ret, |
| 240 | /*noutputs*/ 1, |
| 241 | /*targets*/ nullptr, /*ntargets*/ 0, |
| 242 | /*run_metadata*/ nullptr, status); |
| 243 | if (VLOG_IS_ON(1) && status->status.ok()) { |
| 244 | tensorflow::Tensor tensor; |
| 245 | if (tensorflow::TF_TensorToTensor(ret, &tensor).ok()) { |
| 246 | VLOG(1) << "Dequeued tensor content: " << tensor.DebugString(); |
| 247 | } |
| 248 | } |
| 249 | return ret; |
| 250 | } |
| 251 | |
| 252 | void TF_EnqueueNamedTensor(TF_Session* session, int tensor_id, |
| 253 | TF_Tensor* tensor, TF_Status* status) { |
nothing calls this directly
no test coverage detected