Your example won’t work, as you cannot create a tensor using your inputs of different lengths.
Internally each tensor holds the data as a blob storing internal attributes such as the stride and shape of the tensor. This makes is possible e.g. to apply batched operations.
As you can see in the docs 59 of nn.Embedding, this layer will take  LongTensors of arbitrary shape as its input.