char-rnn icon indicating copy to clipboard operation
char-rnn copied to clipboard

question about splitTable in model/LSTM.lua

Open YitzhakSp opened this issue 9 years ago • 2 comments

in model/LSTM.lua we have the following code sequence

local reshaped = nn.Reshape(4, rnn_size)(all_input_sums) local n1, n2, n3, n4 = nn.SplitTable(2)(reshaped):split(4)

my question is about the second line. if I understand correctly here the (4, rnn_size)-tensor is being split in 4 tensors. now SplitTable(2) means that the split goes along the second dimension. wouldn't it be more natural to split along the first dimension or am I missing something ?

YitzhakSp avatar Jul 25 '16 07:07 YitzhakSp

@YitzhakSp I think the first dimension corresponds to the "batchsize".

bearpaw avatar Sep 05 '16 07:09 bearpaw

@YitzhakSp @bearpaw yes, the first dim should correspond to the batch_size. Maybe when we call the lstm.lua in train, the model has been utilized automatically for parallel processing, which I mean the input size comes to batch_size * vocab_size

SJTUsuperxu avatar Nov 01 '16 02:11 SJTUsuperxu