lstm
lstm copied to clipboard
why split gates along dimension 2?
Hi, I can not understand why in the following code, the reshaped_gates
is split along dimension 2 rather than 1, since output of reshaped_gates
is a 4 x rnn_size
matrix.
-- Reshape to (batch_size, n_gates, hid_size)
-- Then slize the n_gates dimension, i.e dimension 2
local reshaped_gates = nn.Reshape(4,params.rnn_size)(gates)
local sliced_gates = nn.SplitTable(2)(reshaped_gates)
Could anybody explain it? Thx in advance!
Same question, I will do some experiment to check if this is a bug..
The batch size is the No.1 dim; the 4 gates stuff is the No.2 dim. Plus nn.Reshape() supports batch processing. Therefore this is correct.