When I pass a batch of sequences of variable lengths to torch.nn.CTCLoss, I need to first run pad_packed_sequence() to pad all the sequences to the maximun sequence length. Because CTCLoss only accept Tensor of size TNC(or NTC) as input.
But the problem is my sequence lengths is heavily biased, for an extrem example my sequence lengths is like [10000, 1, 1, 1, 1 … 1]. In this situation the padding cost much time and memory.
So can I just pass a PackedSequence to CTCLoss and skip pad_packed_sequence()?