python - Tensorflow session returns as 'closed' -


i have ported cifar-10 convnet tutorial code own images , able train on data , generate tensorboard outputs etc.

my next step implement evaluation of new data against model built. trying use cifar10_eval.py starting point running difficulty.

i should point out original tutorial code runs entirely without problem, including cifar10_eval.py. however, when moving particular code application, following error message (last line).

runtimeerror: attempted use closed session. 

i found error thrown tf's session.py

# check session. if self._closed:   raise runtimeerror('attempted use closed session.') 

i have checked directories in files should reside , created, , seems should (they mirror created running original tutorial code). include train, eval , data folders, containing checkpoints/events files, events file, , data binaries respectively.

i wonder if pointing out how can debug this, i'm sure there may in data flow got disrupted when transitioning code. unfortunately, despite digging deep , comparing original, can't find source, similar trivial changes in file names , destination directories only.

edit_01: debugging step step, seems line throws error #106 in original cifar10_eval.py:

    def eval_once(args etc)     ...           tf.session() sess:       ...            summary = tf.summary()         summary.parsefromstring(sess.run(summary_op))  # <========== line 106 

summary_op created in def evaluate of same script , passed arg def eval_once.

summary_op = tf.merge_all_summaries() ... while true:   eval_once(saver, summary_writer, top_k_op, summary_op) 

from documentation on session, session can closed .close command or when using through context-manager in with block. did find tensorflow/models/image/cifar10 | xargs grep "sess" , don't see sess.close, must later.

ie, you'll error if this

with tf.session() sess:    sess.run(..)  sess.run(...)  # attempted use closed session. 

Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo