2016-07-30 12 views
8

मैंने टेंसफोर्लो में एक संकल्पक तंत्रिका नेटवर्क बनाया था। यह प्रशिक्षित है और अब मैं इसे अनपॅक कर रहा हूं और मूल्यांकन कर रहा हूं।टेन्सफोर्लो एनक्यू ऑपरेशन रद्द कर दिया गया

import main 
import Process 
import Input 

eval_dir = "/Users/Zanhuang/Desktop/NNP/model.ckpt-250" 
checkpoint_dir = "/Users/Zanhuang/Desktop/NNP/checkpoint" 

def evaluate(): 
    with tf.Graph().as_default() as g: 
    images, labels = Process.eval_inputs() 
    forward_propgation_results = Process.forward_propagation(images) 
    init_op = tf.initialize_all_variables() 
    saver = tf.train.Saver() 
    top_k_op = tf.nn.in_top_k(forward_propgation_results, labels, 1) 

    with tf.Session(graph=g) as sess: 
    tf.train.start_queue_runners(sess=sess) 
    sess.run(init_op) 
    saver.restore(sess, eval_dir) 
    print(sess.run(top_k_op)) 


def main(argv=None): 
    evaluate() 

if __name__ == '__main__': 
    tf.app.run() 

दुर्भाग्यवश एक अजीब त्रुटि आई है और मुझे कोई संकेत नहीं है।

W tensorflow/core/kernels/queue_base.cc:2 
W tensorflow/core/kernels/queue_base.cc:294] _0_input_producer: Skipping cancelled enqueue attempt with queue not closed 
W tensorflow/core/kernels/queue_base.cc:294] _1_batch/fifo_queue: Skipping cancelled enqueue attempt with queue not closed 
E tensorflow/core/client/tensor_c_api.cc:485] Enqueue operation was cancelled 
    [[Node: batch/fifo_queue_enqueue = QueueEnqueue[Tcomponents=[DT_FLOAT, DT_INT32], _class=["loc:@batch/fifo_queue"], timeout_ms=-1, _device="/job:localhost/replica:0/task:0/cpu:0"](batch/fifo_queue, Cast_1, Cast)]] 
E tensorflow/core/client/tensor_c_api.cc:485] Enqueue operation was cancelled 
    [[Node: batch/fifo_queue_enqueue = QueueEnqueue[Tcomponents=[DT_FLOAT, DT_INT32], _class=["loc:@batch/fifo_queue"], timeout_ms=-1, _device="/job:localhost/replica:0/task:0/cpu:0"](batch/fifo_queue, Cast_1, Cast)]] 
E tensorflow/core/client/tensor_c_api.cc:485] Enqueue operation was cancelled 
    .... 
    [[Node: batch/fifo_queue_enqueue = QueueEnqueue[Tcomponents=[DT_FLOAT, DT_INT32], _class=["loc:@batch/fifo_queue"], timeout_ms=-1, _device="/job:localhost/replica:0/task:0/cpu:0"](batch/fifo_queue, Cast_1, Cast)]] 
E tensorflow/core/client/tensor_c_api.cc:485] Enqueue operation was cancelled 
    [[Node: batch/fifo_queue_enqueue = QueueEnqueue[Tcomponents=[DT_FLOAT, DT_INT32], _class=["loc:@batch/fifo_queue"], timeout_ms=-1, _device="/job:localhost/replica:0/task:0/cpu:0"](batch/fifo_queue, Cast_1, Cast)]] 
W tensorflow/core/kernels/queue_base.cc:294] _1_batch/fifo_queue: Skipping cancelled enqueue attempt with queue not closed 
... 
W tensorflow/core/kernels/queue_base.cc:294] _1_batch/fifo_queue: Skipping cancelled enqueue attempt with queue not closed 
E tensorflow/core/client/tensor_c_api.cc:485] Enqueue operation was cancelled 

यह केवल इसका एक हिस्सा है।

+1

कि tensorflow –

+1

मेरे पास है के नए संस्करण में निकाला जा चुका है एक हानिरहित जानकारी संदेश है कि इस्तेमाल किया जाएगा Tensorflow 9.0। नवीनतम संस्करण कौन सा है, और रात का निर्माण। इसके अलावा, यह मुझे प्रोग्राम चलाने जारी नहीं रखेगा। –

+0

यह स्पष्ट नहीं है कि यह संदेश एक त्रुटि इंगित करता है। मैं इसे अनदेखा करूँगा और वास्तविक समस्या को डीबग करने का प्रयास करूंगा। आईई, कतारों पर कुछ भी लगाए गए कतार धावक हैं (उन्हें शुरू करने के बाद queue.size() देखें)? –

उत्तर

20

चैट से अपडेट करें - प्रोग्राम सफलतापूर्वक चलता है, और मुद्रित संदेश पाइथन हत्या के थ्रेड के कारण होते हैं जब वे प्रक्रिया समाप्त हो जाते हैं।

संदेश हानिरहित हैं लेकिन नीचे पैटर्न का उपयोग करके मैन्युअल रूप से धागे को रोककर उनसे बचना संभव है।

coord = tf.train.Coordinator() 
threads = tf.train.start_queue_runners(sess=sess, coord=coord) 
<do stuff> 
coord.request_stop() 
coord.join(threads) 
+1

मैं अभी भी इसे टेंसरफ्लो 1.1 में प्राप्त कर रहा हूं, किसी भी कारण से यह अभी भी आसपास है? – martianwars

0

सबकुछ ठीक से काम करता है और समस्या अंतिम चरण में होती है जब पायथन थ्रेड को मारने की कोशिश करता है। ऐसा करने के लिए ठीक से आप एक train.Coordinator बनाएं और उसे अपने queue_runner (कोई सेक्स पारित करने के लिए की जरूरत को पारित करना चाहिए, के रूप में डिफ़ॉल्ट सत्र

with tf.Session() as sess: 
    coord = tf.train.Coordinator() 
    threads = tf.train.start_queue_runners(coord=coord) 
    // do your things 
    coord.request_stop() 
    coord.join(threads) 
संबंधित मुद्दे

 संबंधित मुद्दे