Variable Sequence for RNN

Hi everyone,

I just started working with RNN models. I want to train an RNN for classification based on the following input. I have sequences of data x for many subjects. The length of each sequence differs. But the dimension of each x is the same. E.g. in the picture below constant a and b are different in the for subjects.

image

During training, I want to draw batches of my subject, but since they have variable length, is there a way to mask/pad it? I am aware of pack_padded_sequence, but I am unsure how to use it from the documentation. Anyone know how to do it? Thanks for your time!