How to train network?

I’m very new to Pytorch so please bear with me…

I have currently implemented the forward part of a network such that it can take a variable length input and return a fixed length output. I feed it a tensor of size [variable length x 30] and it returns a tensor of size [1 x 30]

However, I need to be able to train the network on lots of inputs, all of differing length, and their corresponding outputs. The examples I have seen on the Pytorch website use tensors wrapped inside Variable()s for both the inputs and outputs, which they then pass to the model and the loss function. However, I don’t think I can combine all my inputs into a single tensor as they are all of differing length.

Any ideas?