Commit 417ecb4b authored by vineetk1's avatar vineetk1 Committed by Facebook Github Bot
Browse files

Added a comment to inform coders that pack_padded_sequence requires that...

Added a comment to inform coders that pack_padded_sequence requires that padding must be on the right (#860)

Summary:
The PyTorch document on pack_padded_sequence has no information regarding a requirement that padding must be on the right. Therefore, this information is added as a comment on Line 212 of [https://github.com/vineetk1/fairseq/blob/master/fairseq/models/lstm.py](url)
Pull Request resolved: https://github.com/pytorch/fairseq/pull/860

Differential Revision: D16142102

Pulled By: myleott

fbshipit-source-id: 7cb6d4df64b17b54b223de03bd966ca16077c3fe
parent cc292afa
......@@ -209,6 +209,7 @@ class LSTMEncoder(FairseqEncoder):
def forward(self, src_tokens, src_lengths):
if self.left_pad:
# nn.utils.rnn.pack_padded_sequence requires right-padding;
# convert left-padding to right-padding
src_tokens = utils.convert_padding_direction(
src_tokens,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment