Closed hsh2438 closed 7 years ago
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_finalstate, = 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.
Check out loop_fn_transition above, it feeds PAD token at the 1 decoding step, then feeds previously generated tokens.
loop_fn_transition
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]:
decoder_outputs_ta, decoder_finalstate, = 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.