You would have to handle this use case and PyTorch doesn’t limit the approaches by assuming a max length or something like that.
E.g. if you are working with variable input shapes and would like to classify each sample in the temporal dimension, you could just use a target with the same (variable) sequence length.
On the other hand, you might want to classify the complete sequence to a specific class, so while the input would have a (variable) temporal dimension, your target should have a class index for each sample.
The processing highly depends on your use case.