Tensorflow保护程序无法正常运行

时间:2017-06-19 06:47:18

标签: python tensorflow

我在我的测试模块中保存了我的模型。由于tensorflow正在使用新的保存方案,因此它不直接存储.ckpt文件。因此,我们使用.data-00000-of-00001和.index文件代替.ckpt文件。

我的保存代码:

saver = tf.train.Saver()
save_path = saver.save(sess, 'D:\Speech_Project\my_model\my_model_01')

恢复:

saver = tf.train.import_meta_graph('D:\Speech_Project\my_model\my_model_01.meta')
saver.restore(sess, tf.train.latest_checkpoint('./'))

我得到的错误是:

TypeError: expected bytes, NoneType found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:/Users/admin/PycharmProjects/BanglaCNN01/banglacnn05.py", line 318, in <module>
test_cnn(X1)
File "C:/Users/admin/PycharmProjects/BanglaCNN01/banglacnn05.py", line 243, in test_cnn
saver.restore(sess, tf.train.latest_checkpoint('./'))
File "C:\Users\admin\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\training\saver.py", line 1428, in restore
{self.saver_def.filename_tensor_name: save_path})
File "C:\Users\admin\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\client\session.py", line 767, in run
run_metadata_ptr)
File "C:\Users\admin\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\client\session.py", line 965, in _run
feed_dict_string, options, run_metadata)
File "C:\Users\admin\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\client\session.py", line 1015, in _do_run
target_list, options, run_metadata)
File "C:\Users\admin\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\client\session.py", line 1022, in _do_call
return fn(*args)
File "C:\Users\admin\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\client\session.py", line 1004, in _run_fn
status, run_metadata)
SystemError: <built-in function TF_Run> returned a result with an error set

Process finished with exit code 1

请注意,所有代码都在同一个.py文件中。适用于Windows CPU版本的Tensorflow版本1.0.1。即使有了

graph = tf.get_default_graph()

错误是一样的。需要你的见解。

0 个答案:

没有答案