def forward_state(self, sequence, state=None):
if state is None:<EOL><INDENT>state = self.zero_state(sequence.size(<NUM_LIT:0>))<EOL><DEDENT>data = self.input_block(sequence)<EOL>state_outputs = []<EOL>for idx in range(len(self.recurrent_layers)):<EOL><INDENT>layer_length = self.recurrent_layers[idx].state_dim<EOL>current_state = state[:, :, :layer_length]<EOL>state = state[:, :, layer_length:]<EOL>data, new_h = self.recurrent_layers[idx](data, current_state)<EOL>if self.dropout_layers:<EOL><INDENT>data = self.dropout_layers[idx](data)<EOL><DEDENT>state_outputs.append(new_h)<EOL><DEDENT>output_data = self.output_activation(self.output_layer(data))<EOL>concatenated_hidden_output = torch.cat(state_outputs, dim=<NUM_LIT:2>)<EOL>return output_data, concatenated_hidden_output<EOL>
Forward propagate a sequence through the network accounting for the state