Element-Research / rnn

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

Doubt regarding MaskZero #433

Open vguptai opened 6 years ago

vguptai commented 6 years ago

Hi,

I have variable length sequences and I am zero padding them and adding them to a batch. I am using LSTM decorated with a Sequencer to classify these sequences. I have two questions:

1) Does it matter if I zero pad smaller sequences on LEFT or RIGHT? Following discussion https://github.com/Element-Research/rnn/issues/75 suggests left padding should be done. Is this correct?

2) Does MaskZero skip all the zeros in the input while forward and backward or it only skips those zeros which are continuous and till the end of tensor. How does MakeZero differentiate whether zero in the input row is actual data or padding?

For ex. A sequence can look like this: 4, 5, 0, 5, 0, 0, 0

Will MaskZero process the zero at third location correctly?