Hi, I’m trying to implement a CNN model as below:

CNN-Architecture1762×724 35.8 KB

However, I got the error [Expected 4-dimensional input for 4-dimensional weight 32 1 5 5, but got 2-dimensional input of size [2048, 2048] and I don’t know how to solve the problem, Can anybody help me? Thạnk you really much !!!
My CNN code:
    MLP_modules = []
MLP_modules.append(nn.Conv2d(1, 32 , kernel_size =  5))
MLP_modules.append(nn.ReLU())
MLP_modules.append(nn.Conv2d(32, 1, kernel_size = 3))
MLP_modules.append(nn.ReLU())
MLP_modules.append(nn.Conv2d(32, 1, kernel_size = 2))
MLP_modules.append(nn.ReLU())
self.MLP_layers = nn.Sequential(*MLP_modules) 

forward() func:
embed_user_MLP = self.embed_user_GMF(user)
embed_item_MLP = self.embed_item_GMF(item)
interaction_matrix = torch.ger(embed_user_MLP.reshape(-1), embed_item_MLP.reshape(-1))
output_MCLP = self.MLP_layers(interaction_matrix)