-1

我的 Linux 终端截图在这里

# the error entry in linux terminal screenshot            
if FLAGS.validation_db:
      val_model.start_queue_runners(sess)
      Validation(sess, val_model, 0)

#the call func above val_model
def start_queue_runners(self, sess):
    logging.info('Starting queue runners (%s)', self.stage)
    # Distinguish the queue runner collection (for easily obtaining them by 
    collection key)
    queue_runners = tf.get_collection(tf.GraphKeys.QUEUE_RUNNERS, 
    scope=self.stage+'.*')
    for qr in queue_runners:
        if self.stage in qr.name:
            tf.add_to_collection(digits.GraphKeys.QUEUE_RUNNERS, qr)

    self.queue_coord = tf.train.Coordinator()
    self.queue_threads = tf.train.start_queue_runners(sess=sess, 
    coord=self.queue_coord,

    collection=digits.GraphKeys.QUEUE_RUNNERS)
    logging.info('Queue runners started (%s)', self.stage)

我的linux终端发生了什么,需要修改哪里?我在stackoverflow中找到了一些关于它的答案,但它不适合我

具体错误如下:

2017-12-19 05:49:34 [INFO] Starting queue runners (val)
Traceback (most recent call last):
File "/root/digits/digits/tools/tensorflow/main.py", line 627, in main
val_model.start_queue_runners(sess)
File "/root/digits/digits/tools/tensorflow/model.py", line 208, in 
start_queue_runners
tf.add_to_collection(digits.GraphKeys.QUEUE_RUNNERS, qr)
File "/usr/local/lib/python2.7/dist-
packages/tensorflow/python/framework/ops.py", line 4
248, in add_to_collection    get_default_graph().add_to_collection(name, 
value)
File "/usr/local/lib/python2.7/dist-
packages/tensorflow/python/framework/ops.py", line 2
792, in add_to_collection    self._check_not_finalized()
File "/usr/local/lib/python2.7/dist-
packages/tensorflow/python/framework/ops.py", line 2
181, in _check_not_finalized    raise RuntimeError("Graph is finalized and 
cannot be modified.")
RuntimeError: Graph is finalized and cannot be modified.
4

1 回答 1

0

您无需修改​​图表即可启动队列运行器。目前尚不清楚您在这里尝试做什么,但以下代码是等效的并且不会修改图表:

def start_queue_runners(self, sess):
    logging.info('Starting queue runners (%s)', self.stage)

    queue_runners = tf.get_collection(tf.GraphKeys.QUEUE_RUNNERS, 
                                      scope=self.stage+'.*')

    self.queue_coord = tf.train.Coordinator()

    # Start the queue runner threads directly without adding them to a collection.
    for qr in queue_runners:
        if self.stage in qr.name:
            qr.create_threads(sess, coord=self.queue_coord)

    logging.info('Queue runners started (%s)', self.stage)
于 2017-12-19T16:19:17.787 回答