Creating custom RNNs that work with packed sequences

I’m curious on whether PyTorch provides convenience functions for working with packed sequences. If I implement a custom RNN (not one of those provided by PyTorch), how would I work with a packed sequence?

Well, an alternative solution might be to ignore padding and packing (for the time being). I usually create batches that ensure the input and/or target sequences have the same lengths. But there might be caveats.