tensorflow转换代码在恢复变量时给出错误

时间:2016-08-24 17:39:54

标签: python python-2.7 tensorflow

我指的是this tensorflow教程中的序列到序列模型。我在GPU服务器上运行它。培训没有任何错误。但是,当从保存的检查点恢复值时,会出现此错误..

W tensorflow/core/framework/op_kernel.cc:936] Not found: Tensor name "embedding_attention_seq2seq/embedding_attention_decoder/attention_decoder/MultiRNNCell/Cell2/GRUCell/Candidate/Linear/Bias" not found in checkpoint files /home/ramesh/MyData/train/translate.ckpt-100
         [[Node: save/restore_slice_31 = RestoreSlice[dt=DT_FLOAT, preferred_shard=-1, _device="/job:localhost/replica:0/task:0/cpu:0"](_recv_save/Const_0, save/restore_slice_31/tensor_name, save/restore_slice_31/shape_and_slice)]]
W tensorflow/core/framework/op_kernel.cc:936] Not found: Tensor name "embedding_attention_seq2seq/embedding_attention_decoder/attention_decoder/MultiRNNCell/Cell2/GRUCell/Candidate/Linear/Bias" not found in checkpoint files /home/ramesh/MyData/train/translate.ckpt-100
         [[Node: save/restore_slice_31 = RestoreSlice[dt=DT_FLOAT, preferred_shard=-1, _device="/job:localhost/replica:0/task:0/cpu:0"](_recv_save/Const_0, save/restore_slice_31/tensor_name, save/restore_slice_31/shape_and_slice)]]
W tensorflow/core/framework/op_kernel.cc:936] Not found: Tensor name "embedding_attention_seq2seq/embedding_attention_decoder/attention_decoder/MultiRNNCell/Cell2/GRUCell/Candidate/Linear/Bias" not found in checkpoint files /home/ramesh/MyData/train/translate.ckpt-100
         [[Node: save/restore_slice_31 = RestoreSlice[dt=DT_FLOAT, preferred_shard=-1, _device="/job:localhost/replica:0/task:0/cpu:0"](_recv_save/Const_0, save/restore_slice_31/tensor_name, save/restore_slice_31/shape_and_slice)]]
W tensorflow/core/framework/op_kernel.cc:936] Not found: Tensor name "embedding_attention_seq2seq/embedding_attention_decoder/attention_decoder/MultiRNNCell/Cell2/GRUCell/Candidate/Linear/Bias" not found in checkpoint files /home/ramesh/MyData/train/translate.ckpt-100
         [[Node: save/restore_slice_31 = RestoreSlice[dt=DT_FLOAT, preferred_shard=-1, _device="/job:localhost/replica:0/task:0/cpu:0"](_recv_save/Const_0, save/restore_slice_31/tensor_name, save/restore_slice_31/shape_and_slice)]]
W tensorflow/core/framework/op_kernel.cc:936] Not found: Tensor name "embedding_attention_seq2seq/embedding_attention_decoder/attention_decoder/MultiRNNCell/Cell2/GRUCell/Candidate/Linear/Bias" not found in checkpoint files /home/ramesh/MyData/train/translate.ckpt-100
         [[Node: save/restore_slice_31 = RestoreSlice[dt=DT_FLOAT, preferred_shard=-1, _device="/job:localhost/replica:0/task:0/cpu:0"](_recv_save/Const_0, save/restore_slice_31/tensor_name, save/restore_slice_31/shape_and_slice)]]
W tensorflow/core/framework/op_kernel.cc:936] Not found: Tensor name "embedding_attention_seq2seq/embedding_attention_decoder/attention_decoder/MultiRNNCell/Cell2/GRUCell/Candidate/Linear/Bias" not found in checkpoint files /home/ramesh/MyData/train/translate.ckpt-100
         [[Node: save/restore_slice_31 = RestoreSlice[dt=DT_FLOAT, preferred_shard=-1, _device="/job:localhost/replica:0/task:0/cpu:0"](_recv_save/Const_0, save/restore_slice_31/tensor_name, save/restore_slice_31/shape_and_slice)]]
W tensorflow/core/framework/op_kernel.cc:936] Not found: Tensor name "embedding_attention_seq2seq/embedding_attention_decoder/attention_decoder/MultiRNNCell/Cell2/GRUCell/Candidate/Linear/Bias" not found in checkpoint files /home/ramesh/MyData/train/translate.ckpt-100
         [[Node: save/restore_slice_31 = RestoreSlice[dt=DT_FLOAT, preferred_shard=-1, _device="/job:localhost/replica:0/task:0/cpu:0"](_recv_save/Const_0, save/restore_slice_31/tensor_name, save/restore_slice_31/shape_and_slice)]]
W tensorflow/core/framework/op_kernel.cc:936] Not found: Tensor name "embedding_attention_seq2seq/embedding_attention_decoder/attention_decoder/MultiRNNCell/Cell2/GRUCell/Candidate/Linear/Bias" not found in checkpoint files /home/ramesh/MyData/train/translate.ckpt-100
         [[Node: save/restore_slice_31 = RestoreSlice[dt=DT_FLOAT, preferred_shard=-1, _device="/job:localhost/replica:0/task:0/cpu:0"](_recv_save/Const_0, save/restore_slice_31/tensor_name, save/restore_slice_31/shape_and_slice)]]
W tensorflow/core/framework/op_kernel.cc:936] Not found: Tensor name "embedding_attention_seq2seq/embedding_attention_decoder/attention_decoder/MultiRNNCell/Cell2/GRUCell/Candidate/Linear/Bias" not found in checkpoint files /home/ramesh/MyData/train/translate.ckpt-100
         [[Node: save/restore_slice_31 = RestoreSlice[dt=DT_FLOAT, preferred_shard=-1, _device="/job:localhost/replica:0/task:0/cpu:0"](_recv_save/Const_0, save/restore_slice_31/tensor_name, save/restore_slice_31/shape_and_slice)]]
W tensorflow/core/framework/op_kernel.cc:936] Not found: Tensor name "embedding_attention_seq2seq/embedding_attention_decoder/attention_decoder/MultiRNNCell/Cell2/GRUCell/Candidate/Linear/Bias" not found in checkpoint files /home/ramesh/MyData/train/translate.ckpt-100
         [[Node: save/restore_slice_31 = RestoreSlice[dt=DT_FLOAT, preferred_shard=-1, _device="/job:localhost/replica:0/task:0/cpu:0"](_recv_save/Const_0, save/restore_slice_31/tensor_name, save/restore_slice_31/shape_and_slice)]]
W tensorflow/core/framework/op_kernel.cc:936] Not found: Tensor name "embedding_attention_seq2seq/embedding_attention_decoder/attention_decoder/MultiRNNCell/Cell2/GRUCell/Candidate/Linear/Bias" not found in checkpoint files /home/ramesh/MyData/train/translate.ckpt-100
         [[Node: save/restore_slice_31 = RestoreSlice[dt=DT_FLOAT, preferred_shard=-1, _device="/job:localhost/replica:0/task:0/cpu:0"](_recv_save/Const_0, save/restore_slice_31/tensor_name, save/restore_slice_31/shape_and_slice)]]
W tensorflow/core/framework/op_kernel.cc:936] Not found: Tensor name "embedding_attention_seq2seq/embedding_attention_decoder/attention_decoder/MultiRNNCell/Cell2/GRUCell/Candidate/Linear/Bias" not found in checkpoint files /home/ramesh/MyData/train/translate.ckpt-100
         [[Node: save/restore_slice_31 = RestoreSlice[dt=DT_FLOAT, preferred_shard=-1, _device="/job:localhost/replica:0/task:0/cpu:0"](_recv_save/Const_0, save/restore_slice_31/tensor_name, save/restore_slice_31/shape_and_slice)]]
W tensorflow/core/framework/op_kernel.cc:936] Not found: Tensor name "embedding_attention_seq2seq/embedding_attention_decoder/attention_decoder/MultiRNNCell/Cell2/GRUCell/Candidate/Linear/Bias" not found in checkpoint files /home/ramesh/MyData/train/translate.ckpt-100
         [[Node: save/restore_slice_31 = RestoreSlice[dt=DT_FLOAT, preferred_shard=-1, _device="/job:localhost/replica:0/task:0/cpu:0"](_recv_save/Const_0, save/restore_slice_31/tensor_name, save/restore_slice_31/shape_and_slice)]]
W tensorflow/core/framework/op_kernel.cc:936] Not found: Tensor name "embedding_attention_seq2seq/embedding_attention_decoder/attention_decoder/MultiRNNCell/Cell2/GRUCell/Candidate/Linear/Bias" not found in checkpoint files /home/ramesh/MyData/train/translate.ckpt-100
         [[Node: save/restore_slice_31 = RestoreSlice[dt=DT_FLOAT, preferred_shard=-1, _device="/job:localhost/replica:0/task:0/cpu:0"](_recv_save/Const_0, save/restore_slice_31/tensor_name, save/restore_slice_31/shape_and_slice)]]
W tensorflow/core/framework/op_kernel.cc:936] Not found: Tensor name "embedding_attention_seq2seq/embedding_attention_decoder/attention_decoder/MultiRNNCell/Cell2/GRUCell/Candidate/Linear/Bias" not found in checkpoint files /home/ramesh/MyData/train/translate.ckpt-100
         [[Node: save/restore_slice_31 = RestoreSlice[dt=DT_FLOAT, preferred_shard=-1, _device="/job:localhost/replica:0/task:0/cpu:0"](_recv_save/Const_0, save/restore_slice_31/tensor_name, save/restore_slice_31/shape_and_slice)]]
W tensorflow/core/framework/op_kernel.cc:936] Not found: Tensor name "embedding_attention_seq2seq/embedding_attention_decoder/attention_decoder/MultiRNNCell/Cell2/GRUCell/Candidate/Linear/Bias" not found in checkpoint files /home/ramesh/MyData/train/translate.ckpt-100
         [[Node: save/restore_slice_31 = RestoreSlice[dt=DT_FLOAT, preferred_shard=-1, _device="/job:localhost/replica:0/task:0/cpu:0"](_recv_save/Const_0, save/restore_slice_31/tensor_name, save/restore_slice_31/shape_and_slice)]]
W tensorflow/core/framework/op_kernel.cc:936] Not found: Tensor name "embedding_attention_seq2seq/embedding_attention_decoder/attention_decoder/MultiRNNCell/Cell2/GRUCell/Candidate/Linear/Bias" not found in checkpoint files /home/ramesh/MyData/train/translate.ckpt-100
         [[Node: save/restore_slice_31 = RestoreSlice[dt=DT_FLOAT, preferred_shard=-1, _device="/job:localhost/replica:0/task:0/cpu:0"](_recv_save/Const_0, save/restore_slice_31/tensor_name, save/restore_slice_31/shape_and_slice)]]
W tensorflow/core/framework/op_kernel.cc:936] Not found: Tensor name "embedding_attention_seq2seq/embedding_attention_decoder/attention_decoder/MultiRNNCell/Cell2/GRUCell/Candidate/Linear/Bias" not found in checkpoint files /home/ramesh/MyData/train/translate.ckpt-100
         [[Node: save/restore_slice_31 = RestoreSlice[dt=DT_FLOAT, preferred_shard=-1, _device="/job:localhost/replica:0/task:0/cpu:0"](_recv_save/Const_0, save/restore_slice_31/tensor_name, save/restore_slice_31/shape_and_slice)]]
W tensorflow/core/framework/op_kernel.cc:936] Not found: Tensor name "embedding_attention_seq2seq/embedding_attention_decoder/attention_decoder/MultiRNNCell/Cell2/GRUCell/Candidate/Linear/Bias" not found in checkpoint files /home/ramesh/MyData/train/translate.ckpt-100
         [[Node: save/restore_slice_31 = RestoreSlice[dt=DT_FLOAT, preferred_shard=-1, _device="/job:localhost/replica:0/task:0/cpu:0"](_recv_save/Const_0, save/restore_slice_31/tensor_name, save/restore_slice_31/shape_and_slice)]]
W tensorflow/core/framework/op_kernel.cc:936] Not found: Tensor name "embedding_attention_seq2seq/embedding_attention_decoder/attention_decoder/MultiRNNCell/Cell2/GRUCell/Candidate/Linear/Bias" not found in checkpoint files /home/ramesh/MyData/train/translate.ckpt-100
         [[Node: save/restore_slice_31 = RestoreSlice[dt=DT_FLOAT, preferred_shard=-1, _device="/job:localhost/replica:0/task:0/cpu:0"](_recv_save/Const_0, save/restore_slice_31/tensor_name, save/restore_slice_31/shape_and_slice)]]
W tensorflow/core/framework/op_kernel.cc:936] Not found: Tensor name "embedding_attention_seq2seq/embedding_attention_decoder/attention_decoder/MultiRNNCell/Cell2/GRUCell/Candidate/Linear/Bias" not found in checkpoint files /home/ramesh/MyData/train/translate.ckpt-100
         [[Node: save/restore_slice_31 = RestoreSlice[dt=DT_FLOAT, preferred_shard=-1, _device="/job:localhost/replica:0/task:0/cpu:0"](_recv_save/Const_0, save/restore_slice_31/tensor_name, save/restore_slice_31/shape_and_slice)]]
W tensorflow/core/framework/op_kernel.cc:936] Not found: Tensor name "embedding_attention_seq2seq/embedding_attention_decoder/attention_decoder/MultiRNNCell/Cell2/GRUCell/Candidate/Linear/Bias" not found in checkpoint files /home/ramesh/MyData/train/translate.ckpt-100
         [[Node: save/restore_slice_31 = RestoreSlice[dt=DT_FLOAT, preferred_shard=-1, _device="/job:localhost/replica:0/task:0/cpu:0"](_recv_save/Const_0, save/restore_slice_31/tensor_name, save/restore_slice_31/shape_and_slice)]]
W tensorflow/core/framework/op_kernel.cc:936] Not found: Tensor name "embedding_attention_seq2seq/embedding_attention_decoder/attention_decoder/MultiRNNCell/Cell2/GRUCell/Candidate/Linear/Bias" not found in checkpoint files /home/ramesh/MyData/train/translate.ckpt-100
         [[Node: save/restore_slice_31 = RestoreSlice[dt=DT_FLOAT, preferred_shard=-1, _device="/job:localhost/replica:0/task:0/cpu:0"](_recv_save/Const_0, save/restore_slice_31/tensor_name, save/restore_slice_31/shape_and_slice)]]
W tensorflow/core/framework/op_kernel.cc:936] Not found: Tensor name "embedding_attention_seq2seq/embedding_attention_decoder/attention_decoder/MultiRNNCell/Cell2/GRUCell/Candidate/Linear/Bias" not found in checkpoint files /home/ramesh/MyData/train/translate.ckpt-100
         [[Node: save/restore_slice_31 = RestoreSlice[dt=DT_FLOAT, preferred_shard=-1, _device="/job:localhost/replica:0/task:0/cpu:0"](_recv_save/Const_0, save/restore_slice_31/tensor_name, save/restore_slice_31/shape_and_slice)]]
W tensorflow/core/framework/op_kernel.cc:936] Not found: Tensor name "embedding_attention_seq2seq/embedding_attention_decoder/attention_decoder/MultiRNNCell/Cell2/GRUCell/Candidate/Linear/Bias" not found in checkpoint files /home/ramesh/MyData/train/translate.ckpt-100
         [[Node: save/restore_slice_31 = RestoreSlice[dt=DT_FLOAT, preferred_shard=-1, _device="/job:localhost/replica:0/task:0/cpu:0"](_recv_save/Const_0, save/restore_slice_31/tensor_name, save/restore_slice_31/shape_and_slice)]]
W tensorflow/core/framework/op_kernel.cc:936] Not found: Tensor name "embedding_attention_seq2seq/embedding_attention_decoder/attention_decoder/MultiRNNCell/Cell2/GRUCell/Candidate/Linear/Bias" not found in checkpoint files /home/ramesh/MyData/train/translate.ckpt-100
         [[Node: save/restore_slice_31 = RestoreSlice[dt=DT_FLOAT, preferred_shard=-1, _device="/job:localhost/replica:0/task:0/cpu:0"](_recv_save/Const_0, save/restore_slice_31/tensor_name, save/restore_slice_31/shape_and_slice)]]
W tensorflow/core/framework/op_kernel.cc:936] Not found: Tensor name "embedding_attention_seq2seq/embedding_attention_decoder/attention_decoder/MultiRNNCell/Cell2/GRUCell/Candidate/Linear/Bias" not found in checkpoint files /home/ramesh/MyData/train/translate.ckpt-100
         [[Node: save/restore_slice_31 = RestoreSlice[dt=DT_FLOAT, preferred_shard=-1, _device="/job:localhost/replica:0/task:0/cpu:0"](_recv_save/Const_0, save/restore_slice_31/tensor_name, save/restore_slice_31/shape_and_slice)]]
W tensorflow/core/framework/op_kernel.cc:936] Not found: Tensor name "embedding_attention_seq2seq/embedding_attention_decoder/attention_decoder/MultiRNNCell/Cell2/GRUCell/Candidate/Linear/Bias" not found in checkpoint files /home/ramesh/MyData/train/translate.ckpt-100
         [[Node: save/restore_slice_31 = RestoreSlice[dt=DT_FLOAT, preferred_shard=-1, _device="/job:localhost/replica:0/task:0/cpu:0"](_recv_save/Const_0, save/restore_slice_31/tensor_name, save/restore_slice_31/shape_and_slice)]]
W tensorflow/core/framework/op_kernel.cc:936] Not found: Tensor name "embedding_attention_seq2seq/embedding_attention_decoder/attention_decoder/MultiRNNCell/Cell2/GRUCell/Candidate/Linear/Bias" not found in checkpoint files /home/ramesh/MyData/train/translate.ckpt-100
         [[Node: save/restore_slice_31 = RestoreSlice[dt=DT_FLOAT, preferred_shard=-1, _device="/job:localhost/replica:0/task:0/cpu:0"](_recv_save/Const_0, save/restore_slice_31/tensor_name, save/restore_slice_31/shape_and_slice)]]
E tensorflow/core/client/tensor_c_api.cc:485] Tensor name "embedding_attention_seq2seq/embedding_attention_decoder/attention_decoder/MultiRNNCell/Cell2/GRUCell/Candidate/Linear/Bias" not found in checkpoint files /home/ramesh/MyData/train/translate.ckpt-100
         [[Node: save/restore_slice_31 = RestoreSlice[dt=DT_FLOAT, preferred_shard=-1, _device="/job:localhost/replica:0/task:0/cpu:0"](_recv_save/Const_0, save/restore_slice_31/tensor_name, save/restore_slice_31/shape_and_slice)]]
         [[Node: save/restore_all/NoOp_1/_79 = _Recv[client_terminated=false, recv_device="/job:localhost/replica:0/task:0/gpu:0", send_device="/job:localhost/replica:0/task:0/cpu:0", send_device_incarnation=1, tensor_name="edge_231_save/restore_all/NoOp_1", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/gpu:0"]()]]
Traceback (most recent call last):
  File "code/translate.py", line 280, in <module>
    tf.app.run()
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py", line 30, in run
    sys.exit(main(sys.argv))
  File "code/translate.py", line 275, in main
    decode()
  File "code/translate.py", line 212, in decode
    model = create_model(sess, True)
  File "code/translate.py", line 125, in create_model
    model.saver.restore(session, ckpt.model_checkpoint_path)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/saver.py", line 1129, in restore
    {self.saver_def.filename_tensor_name: save_path})
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 382, in run
    run_metadata_ptr)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 655, in _run
    feed_dict_string, options, run_metadata)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 723, in _do_run
    target_list, options, run_metadata)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 743, in _do_call
    raise type(e)(node_def, op, message)
tensorflow.python.framework.errors.NotFoundError: Tensor name "embedding_attention_seq2seq/embedding_attention_decoder/attention_decoder/MultiRNNCell/Cell2/GRUCell/Candidate/Linear/Bias" not found in checkpoint files /home/ramesh/MyData/train/translate.ckpt-100
         [[Node: save/restore_slice_31 = RestoreSlice[dt=DT_FLOAT, preferred_shard=-1, _device="/job:localhost/replica:0/task:0/cpu:0"](_recv_save/Const_0, save/restore_slice_31/tensor_name, save/restore_slice_31/shape_and_slice)]]
         [[Node: save/restore_all/NoOp_1/_79 = _Recv[client_terminated=false, recv_device="/job:localhost/replica:0/task:0/gpu:0", send_device="/job:localhost/replica:0/task:0/cpu:0", send_device_incarnation=1, tensor_name="edge_231_save/restore_all/NoOp_1", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/gpu:0"]()]]
Caused by op u'save/restore_slice_31', defined at:
  File "code/translate.py", line 280, in <module>
    tf.app.run()
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py", line 30, in run
    sys.exit(main(sys.argv))
  File "code/translate.py", line 275, in main
    decode()
  File "code/translate.py", line 212, in decode
    model = create_model(sess, True)
  File "code/translate.py", line 121, in create_model
    forward_only=forward_only)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/models/rnn/translate/seq2seq_model.py", line 166, in __init__
    self.saver = tf.train.Saver(tf.all_variables())
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/saver.py", line 861, in __init__
    restore_sequentially=restore_sequentially)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/saver.py", line 519, in build
    filename_tensor, vars_to_save, restore_sequentially, reshape)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/saver.py", line 272, in _AddRestoreOps
    values = self.restore_op(filename_tensor, vs, preferred_shard)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/saver.py", line 187, in restore_op
    preferred_shard=preferred_shard)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/io_ops.py", line 203, in _restore_slice
    preferred_shard, name=name)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/gen_io_ops.py", line 359, in _restore_slice
    preferred_shard=preferred_shard, name=name)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/op_def_library.py", line 703, in apply_op
    op_def=op_def)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 2310, in create_op
    original_op=self._default_original_op, op_def=op_def)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 1232, in __init__
    self._traceback = _extract_stack()

训练模型后,我按照教程中的说明运行解码功能。

  

python code/translate.py --decode --data_dir=/home/ramesh/MyData/data --train_dir=/home/ramesh/MyData/train

我尝试在tensorflow 0.10和0.9环境中运行代码。但同样的错误出现了。

我提到了thisthis,但我没有回答我的问题。

谢谢!!

0 个答案:

没有答案