reference: https://github.com/udacity/deep-learning/blob/master/seq2seq/sequence_to_sequence_implementation.ipynb

setting: encoding_embedding_size=decoding_embedding_size = 200

error info: Traceback (most recent call last): File "my_encoder_decoder.py", line 369, in main(sys.argv[1]) File "my_encoder_decoder.py", line 346, in main my_qa.train() File "my_encoder_decoder.py", line 298, in train model.build_graph() File "D:\vmware\share\test\chat\seq2seqmodel.py", line 197, in build_graph self._decoding_layer() File "D:\vmware\share\test\chat\seq2seqmodel.py", line 130, in _decoding_layer inference_decoder_output = tf.contrib.seq2seq.dynamic_decode(inference_decoder,impute_finished=False,maximum_iterations=self.max_target_sequence_length)[0] File "d:\Program Files\Anaconda3\lib\site-packages\tensorflow\contrib\seq2seq\python\ops\decoder.py", line 286, in dynamic_decode swap_memory=swap_memory) File "d:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\ops\control_flow_ops.py", line 2770, in while_loop result = context.BuildLoop(cond, body, loop_vars, shape_invariants) File "d:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\ops\control_flow_ops.py", line 2599, in BuildLoop pred, body, original_loop_vars, loop_vars, shape_invariants) File "d:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\ops\control_flow_ops.py", line 2580, in _BuildLoop _EnforceShapeInvariant(m_var, n_var) File "d:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\ops\control_flow_ops.py", line 575, in _EnforceShapeInvariant % (merge_var.name, m_shape, n_shape)) ValueError: The shape for decode_1/decoder/while/Merge_5:0 is not an invariant for the loop. It enters the loop with shape (1, 200), but has shape (?, 200) after one iteration. Provide shape invariants using either the shape_invariants argument of tf.while_loop or set_shape() on the loop variables.

Does anyone know how to solve it?

0

There are 0 answers