Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get error when initializing decoder initial state #16

Open
seanie12 opened this issue May 9, 2018 · 4 comments
Open

Get error when initializing decoder initial state #16

seanie12 opened this issue May 9, 2018 · 4 comments

Comments

@seanie12
Copy link

seanie12 commented May 9, 2018

In seq2seq_model.py file,
I use bi-directional GRU for encoder but I got an error.
More specifically,in line 391, i got an error as follows

"TypeError: Tensor objects are not iterable when eager execution is not enabled. To iterate over this tensor use tf.map_fn."

I use tensorflow 1.7 How can I solve this problem?

In addition, why do have to initialize last decoder cell to zero state not encoder last state as preceding layer?

Thanks in advance

@seanie12
Copy link
Author

I found out a solution
Instead of using list comprehension, use for loop to append every encoder state to new list
and make it tuple. Here is my suggestion if you want to use bi-directional rnn for encoder part

    init_state = []
    for i in range(self.num_layers):
        init_state.append(encoder_last_states[i])
    init_state[-1] = decoder_cell_list[-1].zero_state(batch_size,
                                                      dtype=tf.float32)
    decoder_init_state = tuple(init_state)

@jigyasa06
Copy link

unsupported operand type(s) for -: 'float' and 'Flag'
hey @seanie12 can you please help me with this issue?
this issue is coming when i am running the train.py file..
screen shot 2018-05-27 at 19 55 49

@seanie12
Copy link
Author

seanie12 commented May 28, 2018

@jigyasa06 sorry i don't know how to solve .. maybe @jayparks might help

@jigyasa06
Copy link

hey @jayparks can you please see to this problem?

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

No branches or pull requests

2 participants