Element-Research / rnn

Recurrent Neural Network library for Torch7's nn
BSD 3-Clause "New" or "Revised" License
939 stars 313 forks source link

Accessing Hidden State of LSTM when building nngraph #337

Open mbchang opened 8 years ago

mbchang commented 8 years ago

I have k LSTMs whose hidden states I want to average at every timestep. These averaged hidden states will be the input to the LSTMs in the next timestep (At the moment let's assume that all LSTMS receive the same averaged input). The hidden state is LSTM.hiddenlayer.output. My plan is to wrap the entire network into a Sequencer that goes through time and make it an nngraph, but I am lost in how to access the hidden states when defining the gModule. Would anyone have any insight on this? Thanks!