for i in range(self.layers):
h = tf.concat([fwd_state[i].h, bwd_state[i].h], -1)
c = tf.concat([fwd_state[i].c, bwd_state[i].c], -1)
encoder_state.append(tf.contrib.rnn.LSTMStateTuple(h=h, c=c))
encoder_state = tuple(encoder_state)
return self.output_fn(rnnout, encoder_state)
After Change
// (num_layers * num_directions, batch, hidden_size):
hs = []
for rnn in self.rnns:
outputs, h1, h2 = rnn(inputs, mask=mask)
h = tf.stack([h1, h2])
hs.append(h)
inputs = outputs