Packs a Tensor containing padded sequences of variable length.
Source:R/nn-utils-rnn.R
nn_utils_rnn_pack_padded_sequence.Rdinput can be of size T x B x * where T is the length of the
longest sequence (equal to lengths[1]), B is the batch size, and
* is any number of dimensions (including 0). If batch_first is
TRUE, B x T x * input is expected.
Usage
nn_utils_rnn_pack_padded_sequence(
input,
lengths,
batch_first = FALSE,
enforce_sorted = TRUE
)Arguments
- input
(Tensor): padded batch of variable length sequences.
- lengths
(Tensor): list of sequences lengths of each batch element.
- batch_first
(bool, optional): if
TRUE, the input is expected inB x T x *format.- enforce_sorted
(bool, optional): if
TRUE, the input is expected to contain sequences sorted by length in a decreasing order. IfFALSE, the input will get sorted unconditionally. Default:TRUE.