In the first example you are creating a tensor containing two values: 16 and 128.
As the type is inferred from the input, it’s a torch.LongTensor, which yields the error message (besides having a wrong shape, too).
In your second example you are creating an un-initialized tensor of shape [16, 128].
Your code won’t throw an error, but since the tensor is uninitialized, you might get strange output values.
I assume you would like to create a random tensor of shape [16, 128].
You can do it with x = torch.randn(16, 128).