Function torch::nn::utils::rnn::pack_sequence#
Defined in File rnn.h
Function Documentation#
-
inline PackedSequence torch::nn::utils::rnn::pack_sequence(ArrayRef<Tensor> sequences, bool enforce_sorted = true)#
Packs a list of variable length Tensors.
sequencesshould be a list of Tensors of sizeL x *, whereLis the length of a sequence and*is any number of trailing dimensions, including zero.For unsorted sequences, use
enforce_sorted = false. Ifenforce_sortedistrue, the sequences should be sorted in the order of decreasing length.Arguments: sequences (torch::ArrayRef<Tensor>): A list of sequences of decreasing length. enforce_sorted (bool, optional): if
true, checks that the input contains sequences sorted by length in a decreasing order. Iffalse, this condition is not checked. Default:true.Returns: a
PackedSequenceobject