Who is neal_wu

Models: tutorials / rnn / translate matrix multiplication errors

tensorflow / models / tutorials / rnn / translate / seq2seq_model.py

Hello everybody,

The following problem occurred while running the translation model:

"Translate.py" file, line 294, in main
Train()
"Translate.py" file, line 153, on the train
model = create_model (sess, False)
File "translate.py", line 132, in create_model
dtype = dtype)
File "/Users/richard_xiong/Documents/DeepLearningMaster/RNN/seq2seq_model.py", line 181, in __init__
softmax_loss_function = softmax_loss_function)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/tensorflow/python/ops/seq2seq.py", line 1130, in model_with_buckets
softmax_loss_function = softmax_loss_function))
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/tensorflow/python/ops/seq2seq.py", line 1058, in sequence_loss
softmax_loss_function = softmax_loss_function))
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/tensorflow/python/ops/seq2seq.py", line 1022, in sequence_loss_by_example
crossent = softmax_loss_function (logit, target)
File "/Users/richard_xiong/Documents/DeepLearningMaster/RNN/seq2seq_model.py", line 117, in sampled_loss
num_classes = self.target_vocab_size),
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/tensorflow/python/ops/nn.py", line 1412, in sampled_softmax_loss
Name = name)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/tensorflow/python/ops/nn.py", line 1219, in _compute_sampled_logits
Inputs, sampled_w, transpose_b = True) + sampled_b
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/tensorflow/python/ops/math_ops.py", line 1729, in matmul
a, b, transpose_a = transpose_a, transpose_b = transpose_b, name = name)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/tensorflow/python/ops/gen_math_ops.py", line 1442, in _mat_mul
transpose_b = transpose_b, name = name)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/tensorflow/python/framework/op_def_library.py", line 759, in apply_op
op_def = op_def)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 2242, in create_op
set_shapes_for_outputs (ret)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 1617, in set_shapes_for_outputs
Shapes = Shape_Func (op)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 1568, in call_with_requiring
return call_cpp_shape_fn (op, require_shape_fn = True)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/tensorflow/python/framework/common_shapes.py", line 610, in call_cpp_shape_fn
debug_python_shape_fn, require_shape_fn)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/tensorflow/python/framework/common_shapes.py", line 675, in _call_cpp_shape_fn_impl
Increase ValueError (err.message)
ValueError : Shape must have rank 2, but is rank 1 for 'model_with_buckets / sequence_loss / sequence_loss_by_example / sampled_softmax_loss / MatMul_1' (op: 'MatMul') with input forms: [?], [?, 1024].

It appears that it is the intrinsic matrix multiplication error in the function 'tf.nn.seq2seq.model_with_buckets ()'.

Does anyone have any ideas? Many Thanks!