unpack_sequence#

pytorch_forecasting.utils.unpack_sequence(sequence: Union[Tensor, PackedSequence]) Tuple[Tensor, Tensor][source]#

Unpack RNN sequence.

Parameters

sequence (Union[torch.Tensor, rnn.PackedSequence]) – RNN packed sequence or tensor of which first index are samples and second are timesteps

Returns

tuple of unpacked sequence and length of samples

Return type

Tuple[torch.Tensor, torch.Tensor]