Padding: Standardises variable length sequence
Packing: Format for RNN to ignore the “pads”. Note that we feed the original length (before padding) as input to the pack_pad_sequence function.
The whole sequence is
- pad
- embed
- pack_padded
– [rnn] --> - pad_packed
- eval
The second pad_packed is basically an “unpack”.
Here is a minimal working example with some explanation, hope it helps.
https://suzyahyah.github.io/pytorch/2019/07/01/DataLoader-Pad-Pack-Sequence.html