fairseq
fairseq copied to clipboard
Is the padding use zero-embedding?
As Data.py shows you used padding to get a [batchsize, max_sentence_length] token_input (in class PaddingCollater)
And in Fconv.py, you use Embedding without specifying the embedding of <pad> is an all zero vector.
Am I missing something? Or should padding be zero-embedding? Or doesn't matter?
Thanks.
We pass the padding index to nn.Embedding here: https://github.com/facebookresearch/fairseq-py/blob/84b82dc6d49f386675aee11b26eced623f24db40/fairseq/models/fconv.py#L405
nn.Embedding then automatically replaces this index with zeros.