Skip to content
This repository has been archived by the owner on Dec 11, 2023. It is now read-only.

Error when building BasicDecoder #393

Closed
Zakkery opened this issue Sep 25, 2018 · 1 comment
Closed

Error when building BasicDecoder #393

Zakkery opened this issue Sep 25, 2018 · 1 comment

Comments

@Zakkery
Copy link

Zakkery commented Sep 25, 2018

I am trying to build a pretty simple seq2seq model and I keep getting weird error even though I am following tutorial.

I keep getting ValueError at the decoding stage
ValueError: Could not flatten dictionary. Key had 2 elements, but value had 1 elements. Key: [<tf.Tensor 'decoding/decoder/transpose:0' shape=(70, ?, 128) dtype=float32>, <tf.Tensor 'decoding/decoder/transpose_1:0' shape=(70, ?) dtype=int32>]

Here is my decoder code:

batch_size=70
nodes=128

lstm_dec = tf.contrib.rnn.LSTMCell(nodes)
helper = tf.contrib.seq2seq.TrainingHelper(
    output_embed, output_len, time_major=False, name = "trainHelper"
)
projection_layer = tf.layers.Dense(DICTIONARY_SIZE, name="projection_layer")
# Decoder
decoder = tf.contrib.seq2seq.BasicDecoder(
    lstm_dec,
    helper,
    last_state
)
# Dynamic decoding
outputs, _, _ = tf.contrib.seq2seq.dynamic_decode(decoder)
logits = projection_layer(outputs.rnn_output)

Sadly I couldn't find any explanation for that issue.
The only difference I see is that I am using time_major=False and I tried with time-major data but I got similar error

@Zakkery Zakkery closed this as completed Sep 26, 2018
@nikhilkoditala
Copy link

@Zakkery were you able to solve this? I am facing a similar issue

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants