but nn.Conv2d expects 4 dimensional input, it would not work for three dimensional input.
for image it is like,
[batch_size, number_of_channels, height, width]
output of nn.Embedding will be like,
[number_of_words, embedding_dimension]
we could use nn.Conv1d after nn.Embedding, that is something like,
conv = nn.Conv1d(1, 10, 3) # suppose in_channels is 1, out_channels is 10, kernel_size is 3
emb = nn.Embedding(150, 100) # 150 words, 100 embedding size
doc = torch.LongTensor([0, 1, 2]) # suppose our document has 3 words
z = emb(doc.long()) # output shape [3, 100]
e = z.reshape(3, 1, 100) # reshape it to 3 words, 1 channel, 100 embedding size, to use it with conv1d
conv(e).shape

torch.Size([3, 10, 98])
or if we use nn.Conv2d after nn.Embedding, then we will have to split embedding size 100, into 10x10,
conv = nn.Conv2d(1, 10, 3) # suppose in_channels is 1, out_channels is 10, kernel_size is 3
emb = nn.Embedding(150, 100) # 150 words, 100 embedding size
doc = torch.LongTensor([0, 1, 2]) # suppose our document has 3 words
z = emb(doc.long()) # output shape [3, 100]
e = z.reshape(3, 1, 10, 10) # reshape it to 3 words, 1 channel, 10x10 embedding size, to use it with conv2d
conv(e).shape

torch.Size([3, 10, 8, 8])