ValueError: not enough values to unpack (expected 3, got 2) – python/tensorflow

Home / Uncategorized / ValueError: not enough values to unpack (expected 3, got 2) – python/tensorflow

Question:
I am trying to understand some code implemented using the tensorflow framework on jupyter notebook, when I get the following error on running this cell. I do not understand the problem here and some clarification would be very helpful.

For reference, a training decoding layer is being created here in tensorflow.

Code:
def decoding_layer_train(encoder_state, dec_cell, dec_embed_input,
target_sequence_length, max_summary_length,
output_layer, keep_prob):"""
Create a decoding layer for training:param encoder_state: Encoder State:param dec_cell: Decoder RNN Cell:param dec_embed_input: Decoder embedded input:param target_sequence_length: The lengths of each sequence in the target batch:param max_summary_length: The length of the longest sequence in the batch:param output_layer: Function to apply the output layer:param keep_prob: Dropout keep probability:return: BasicDecoderOutput containing training logits and sample_id
"""
# TODO: Implement Function

# Helper for the training process; used by Basic Decoder to read inputs
training_helper = tf.contrib.seq2seq.TrainingHelper(inputs=dec_embed_input,
sequence_length=target_sequence_length,
time_major=False)

# Basic decoder
training_decoder = tf.contrib.seq2seq.BasicDecoder(dec_cell,
training_helper,
encoder_state,
output_layer)

# Performs dynamic decoding using the decoder
training_decoder_output, final_state, final_sequence_lengths = tf.contrib.seq2seq.dynamic_decode(training_decoder,
impute_finished=True,
maximum_iterations=max_summary_length)

return training_decoder_output

"""
DON’T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE
"""

tests.test_decoding_layer_train(decoding_layer_train)enter code here
Error message (Screenshot):


Answer:
Figured it out. I was using tensorflow 1.1, just had to change that to 1.2 and everything worked 🙂
Read more

Leave a Reply

Your email address will not be published. Required fields are marked *