timbmg / Sentence-VAE

PyTorch Re-Implementation of "Generating Sentences from a Continuous Space" by Bowman et al 2015 https://arxiv.org/abs/1511.06349
580 stars 152 forks source link

Maybe a bug: data leak in decoder when bidirectional == True #22

Open linzeqipku opened 4 years ago

linzeqipku commented 4 years ago

Model.py, Line 41: self.decoder_rnn = rnn(embedding_size, hidden_size, num_layers=num_layers, bidirectional=self.bidirectional, batch_first=True)

If bidirectional == True: When the decoder is decoding the t-th token, it can obtain information from the whole input sentence.

I think this may be a bug, and I'd appreciate that if you can help double-check this. Many thanks.

timbmg commented 3 years ago

Yes that is correct, so bidirectional should not be used in the decoder. Would you like to make a PR for this?