torch.nn.utils.rnn.pad_sequence — PyTorch 1.10.1 documentation
pytorch.org › torchtorch.nn.utils.rnn.pad_sequence. pad_sequence stacks a list of Tensors along a new dimension, and pads them to equal length. For example, if the input is list of sequences with size L x * and if batch_first is False, and T x B x * otherwise. B is batch size. It is equal to the number of elements in sequences . T is length of the longest sequence.