Hi everyone,
I am new to Pytorch (and row major calculations). I would like to build a convolutional neural network for text based applications. My batch size is 64 (64 sentences in each batch), embedding size is 200  and each  sentence contains 80 words. Inside the model  (in init method) I initialize my embeddings as follows:
batch_size = 64
embedding_dim = 200
vocabulary_size = 100
sentence_len = 80
out_channel = 100
self.embedding = nn.Embedding(vocabulary_size,embedding_dim)
# here is the convolutional layer I want to use:
self.conv1 = nn.Conv2d(1,out_channel, kernel_size = (2,embedding_dim))

My input x contains the vocabulary index of the words of sentences in my batch:
x.shape = batch_size,sentence_len.
When I use x to get my embeddings I obtain the [batch_size,sentence_len,embedding_dim] size tensor.
As far as I know, I should reshape it to batch_size,Input_Channel,H,W shape to use it as input to convolutional layer.
My question: If I do it as follows, would it reshape my embeds correctly ?
  def forward(self,x,y):
       embeds     = self.embedding(x) #  embeds shape is 64x 80 x 200 
        #embeds.reshape()
       embeds2  = embeds.view(batch_size,1,sentence_len,embedding_dim)
       out = self.conv1(embeds2)