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

there is no input argument when loop_fn method is called. #25

Closed
hsh2438 opened this issue Jul 27, 2017 · 1 comment
Closed

there is no input argument when loop_fn method is called. #25

hsh2438 opened this issue Jul 27, 2017 · 1 comment

Comments

@hsh2438
Copy link

hsh2438 commented Jul 27, 2017

I am studying Advanced dynamic seq2seq with TensorFlow.
When i executed source code, it works well.
But i have a question among the below source code.

In [21]:

def loop_fn(time, previous_output, previous_state, previous_loop_state):
    if previous_state is None:    # time == 0
        assert previous_output is None and previous_state is None
        return loop_fn_initial()
    else:
        return loop_fn_transition(time, previous_output, previous_state, previous_loop_state)

decoder_outputs_ta, decoder_final_state, _ = tf.nn.raw_rnn(decoder_cell, loop_fn)
decoder_outputs = decoder_outputs_ta.stack()

decoder_outputs_ta, decoder_final_state, _ = tf.nn.raw_rnn(decoder_cell, loop_fn)

Above bolded line call loop_fn method, but there's no input argument.
Then, i wonder how loop_fn method works well.

@ematvey
Copy link
Owner

ematvey commented Aug 20, 2017

Check out loop_fn_transition above, it feeds PAD token at the 1 decoding step, then feeds previously generated tokens.

@ematvey ematvey closed this as completed Aug 20, 2017
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