@vainaijr, thanks for your explanation.



 vainaijr:

emb = nn.Embedding(150, 100)


nn.Embeddin will receive 2 numbers. The first number is the length of the (vocabulary size +1)  and not 150, which is the length of each document. The second number is the embedding dimension, which I considered as 100. I follow the steps here, from here: https://pytorch.org/tutorials/beginner/nlp/word_embeddings_tutorial.html.
What I suppose to get from the embedding layer in the training process is a tensor size of (Batch size, length of the document, embedding dimension), which I am not getting this tensor size. I am getting a tensor size of [batch size,100].
The reason that I posted this question is that for some reason, it looks like that my embedding layer couldn’t convert the indices in my sample to their corresponding embedding vector.
About the CNN part, in NLP, we usually have nnConv2d(1, number of each kind of kernel
(window size of words, word embedding dimension)). In making CNN for text, we keep the width of the kernel in the size of embedding and change the width word by word. Please visit this link:
http://www.wildml.com/2015/11/understanding-convolutional-neural-networks-for-nlp/.
Therefore, my question remains unanswered.
Any thoughts on this?