PackedSequence(data: oneflow.Tensor, batch_sizes: Optional[oneflow.Tensor] = None, sorted_indices: Optional[oneflow.Tensor] = None, unsorted_indices: Optional[oneflow.Tensor] = None)¶
The interface is consistent with PyTorch. The documentation is referenced from: https://pytorch.org/docs/1.10/generated/torch.nn.utils.rnn.PackedSequence.html.
Holds the data and list of
batch_sizesof a packed sequence.
All RNN modules accept packed sequences as inputs.
Instances of this class should never be created manually. They are meant to be instantiated by functions like
Batch sizes represent the number elements at each sequence step in the batch, not the varying sequence lengths passed to
pack_padded_sequence(). For instance, given data
PackedSequencewould contain data
Tensor of integers holding information about the batch size at each sequence step
Tensor of integers holding how this
PackedSequenceis constructed from sequences.
Tensor of integers holding how this to recover the original sequences with correct order.
datacan be on arbitrary device and of arbitrary dtype.
oneflow.int64tensors on the same device as
batch_sizesshould always be a CPU
This invariant is maintained throughout
PackedSequenceclass, and all functions that construct a :class:PackedSequence in PyTorch (i.e., they only pass in tensors conforming to this constraint).