Tensors must be declared with specific sizes in each dimension, so you need to pad the sentences so that they all have the same length, then use pack_padded_sequence if you’re running them through an RNN.