I have created a model using TensorFlow python. Now I have loaded the model in C++ and run it using session->Run (feeding input tensors). The code is complied and linked well, however as soon as it reaches the session->Run during the run time, It doesn't proceed further, and it doesn't create any error message either! It looks like it runs forever! I also checked the CPU usage, but it does not also indicate any intensive computation!
-
1Please read the posting guidelines concerning a minimal example. Your question as it stands is off-topic here. – Ulrich Eckhardt Feb 11 '16 at 17:48
1 Answers
When a TensorFlow program blocks forever, one common issue is that the step is blocked on an empty queue in a q.dequeue()
or q.dequeue_many()
op.
One possibility is that your Python model depends on prefetching threads (derived from tf.train.QueueRunner
objects). Many of the input reading (e.g. using tf.TFRecordReader
), and batching (e.g. using tf.train.batch()
) pipelines implicitly create queues and queue runners.
If you had to run tf.train.start_queue_runners()
in your Python program, then you will need to do the equivalent thing in your C++ code, by forking threads to run the appropriate q.enqueue()
ops. Alternatively, you can prepare the input in your C++ program and feed the graph so that the operations you are trying to run do not depend on dequeuing elements for a queue.

- 125,488
- 26
- 399
- 400