torch:pad-sequence
(torch:pad-sequence sequences &key padding-value)
Returns a list of variable-length sequences (lists, index vectors or tensors) as one padded rank-2 tensor, batch first: (batch longest), every row filled up to the longest one with padding-value (0 by default). This is torch.nn.utils.rnn.pad_sequence with batch_first=True.
The result is a constant tensor of token indices, ready for torch:embedding and for torch:padding-mask.