I want to feed timeseries data as it comes - one step at a time, to incrementally build the rnn ( after few initial steps ).
currently the rnn() takes encoder_input and decoder_input as complete sequence.
def rnn_seq2seq(encoder_inputs, decoder_inputs, cell, initial_state=None,output_projection=None,feed_previous=False, dtype=tf.float32, scope=None):
with tf.variable_scope(scope or "rnn_seq2seq"):
_, enc_states = rnn.rnn(cell, encoder_inputs, initial_state=initial_state, dtype=dtype)
def extract_argmax(prev, i):
with tf.device('/gpu:0'):
prev = tf.nn.softmax(tf.nn.xw_plus_b(prev, output_projection[0], output_projection[1]))
return prev
loop_function = None
if feed_previous:
loop_function = extract_argmax
print enc_states[-1]
return seq2seq.rnn_decoder(decoder_inputs, enc_states[-1], cell, loop_function=loop_function)
feedP = tf.placeholder(dtype=tf.bool)
with tf.variable_scope("mylstm"):
output,state = rnn_seq2seq(enc_inputs,dec_inputs,cell,output_projection=output_projection,feed_previous=feedP)
Is it possible to feed decoder_input one step at a time instead of whole sequence, because that's how the data would come in real time ?