torch.nn.utils.pad_packed_sequence
function pad_packed_sequence(sequence: PackedSequence, options?: PadPackedSequenceOptions): [Tensor, Tensor]function pad_packed_sequence(sequence: PackedSequence, batch_first: boolean, padding_value: number, total_length: number | null, options?: PadPackedSequenceOptions): [Tensor, Tensor]Pad a packed batch of variable length sequences.
It is an inverse operation to pack_padded_sequence.
Parameters
sequencePackedSequence- Batch to pad
optionsPadPackedSequenceOptionsoptional- Optional settings for padding
Returns
Examples
const [padded, lengths] = torch.nn.utils.rnn.pad_packed_sequence(packed, { batch_first: true });