vijendra_rana:

Also the whole functionality, in general, I mean why we need these 2 utilities and how it is useful.


They are used for seq to seq models with variable lengths. Such as a sentence can be of variable length, and to feed it into any class of an RNN, you need to be able to get the output at the right time step.
Furthermore, check your dimensions on, and compare them to the original link:



 vijendra_rana:

input_tensor = torch.zeros(batch_size,max_length,num_input_features)


You should be getting a 3x3 PackedSequence, but you just have a small bug in the code, which is why you are getting a 6x1 PackedSequence.