Hindy_Yuen:

Why the prediction become 3 dimensional ?


I guess because you are feeding a 2D input to the model as seen here:
embeddings = nn.Embedding(100, 10)
linear1 = nn.Linear(10, 100)

x = torch.randint(0, 100, (2, 3))
out = embeddings(x)
print(out.shape) # torch.Size([2, 3, 10])
out = linear1(out)
print(out.shape) # torch.Size([2, 3, 100])

You can print the shapes of all tensors in the forward method to check it manually.
Depending on your knowledge about ML/DL you might want to check out a course (e.g. FastAI) or just take a look at the tutorials. It’s a bit hard to recommend anything else without knowing what you are struggling with.