It seems you are using nn.EmbeddingBag, which outputs [batch_size, embedding_dim], not nn.Embedding, which works as expected:
N, seq = 2, 5
emb = nn.Embedding(num_embeddings=10, embedding_dim=100)
x = torch.randint(0, 10, (N, seq))
output = emb(x)
print(output.shape)
> torch.Size([2, 5, 100])