Hi
I am a newbie in Theano. I was trying to understand and modify Jonathan
Raiman's LSTM code.
Following is the question after a code snipper
def create_prediction(self, greedy=False):
def step(idx, *states):
new_hiddens = [None] + list(states)
new_states = self.model.forward(idx, prev_hiddens=new_hiddens)
if greedy:
new_idxes = new_states[-1]
new_idx = new_idxes.argmax()
return ([new_idx.astype(self.priming_word.dtype)] +
new_states[1:-1]), theano.scan_module.until(
T.eq(new_idx, self._stop_word))
# in sequence forecasting scenario we take everything
# up to the before last step, and predict subsequent
# steps ergo, 0 ... n - 1, hence:
inputs = self.input_mat[:, 0:-1]
num_examples = inputs.shape[0]
# pass this to Theano's recurrence relation function:
# choose what gets outputted at each timestep:
outputs_info = [dict(initial=self.priming_word, taps=[-1])] + \
[initial_state_with_taps(layer, self.input_frame) for layer
in self.model.layers[1:-1]]
print 'output_info calculated in if.'
result, _ = theano.scan(fn=step,
n_steps=200,
outputs_info=outputs_info)
return result[0]
Here the function is "step". There is no "sequences" argument given to the
scan but instead number of steps is given. So when "step" is called what
will go into "idx" and what will go in "*states". I am really confused.
Please help me.
--
---
You received this message because you are subscribed to the Google Groups
"theano-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.