Linked Questions

Popular Questions

I am implementing the seq2seq model in NLP by using tensorflow 1.3.0. However, I am facing an error mentioned in the title question.

I am using function tf.contrib.seq2seq.dynamic_decode()

def DecodeTrainingSet(self, decoder_embedded_input, sequence_length_output, max_length, attn_cell, initial_state, output_layer, decoding_scope):

    train_helper = tf.contrib.seq2seq.TrainingHelper(decoder_embedded_input, sequence_length_output) 

    decoder = tf.contrib.seq2seq.BasicDecoder(cell=attn_cell,  
                                          helper=train_helper,
                                          initial_state=initial_state,                                                   output_layer=output_layer)

    decoder_final_output, decoder_final_state, final_sequence_lengths = tf.contrib.seq2seq.dynamic_decode(decoder=decoder, output_time_major=False,
                                                                                                              impute_finished=True, maximum_iterations=max_length, scope=decoding_scope)

    return decoder_final_output 

This is error:

Original exception was: Traceback (most recent call last): File "/home/xuanphu/Work/chatbot/training.py", line 73, in questionswords2int) File "/home/xuanphu/Work/chatbot/seq2seq.py", line 237, in Seq2SeqModel questionswords2int) File "/home/xuanphu/Work/chatbot/seq2seq.py", line 196, in DecoderRNN decoding_scope) File "/home/xuanphu/Work/chatbot/seq2seq.py", line 102, in DecodeTrainingSet impute_finished=True, maximum_iterations=max_length, scope=decoding_scope) File "/home/xuanphu/.local/lib/python3.6/site-packages/tensorflow/contrib/seq2seq/python/ops/decoder.py", line 286, in dynamic_decode swap_memory=swap_memory) File "/home/xuanphu/.local/lib/python3.6/site-packages/tensorflow/python/ops/control_flow_ops.py", line 2775, in while_loop result = context.BuildLoop(cond, body, loop_vars, shape_invariants) File "/home/xuanphu/.local/lib/python3.6/site-packages/tensorflow/python/ops/control_flow_ops.py", line 2604, in BuildLoop pred, body, original_loop_vars, loop_vars, shape_invariants) File "/home/xuanphu/.local/lib/python3.6/site-packages/tensorflow/python/ops/control_flow_ops.py", line 2495, in _BuildLoop self._InitializeValues(loop_vars) File "/home/xuanphu/.local/lib/python3.6/site-packages/tensorflow/python/ops/control_flow_ops.py", line 2477, in _InitializeValues self._values.add(x.values.name) AttributeError: 'NoneType' object has no attribute 'values'

Related Questions