I made the following changes to get rid of the dimensionality error:
epochs = 20

model.train()
model.double()

for epoch in range(epochs):
    training_loss = 0.0
    
    for data, target in trainloader:
        
        data = data.unsqueeze(0)
        print(data.shape)
        optimizer.zero_grad()
        output=model(data)
        loss = criterion(ouput, target)
        loss.backward()
        optimizer.step()
        training_loss+= loss.tem()*data.size(0)
    
    training_loss = training_loss/len(trainloader.sampler)
    
    print('Epoch: {} \tTraining Loss: {:.6f}'.format(
        epoch+1, 
        training_loss
        ))

However, now I am getting the following issue:
torch.Size([1, 1, 5, 50])
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-27-ce7692ed966f> in <module>
     12         print(data.shape)
     13         optimizer.zero_grad()
---> 14         output=model(data)
     15         loss = criterion(ouput, target)
     16         loss.backward()

D:\Users\user\Anaconda3\lib\site-packages\torch\nn\modules\module.py in __call__(self, *input, **kwargs)
    538             result = self._slow_forward(*input, **kwargs)
    539         else:
--> 540             result = self.forward(*input, **kwargs)
    541         for hook in self._forward_hooks.values():
    542             hook_result = hook(self, input, result)

<ipython-input-24-ef6039735d06> in forward(self, x)
     15     def forward(self, x):
     16         x = F.relu(self.conv1(x))
---> 17         x = F.relu(self.conv2(x))
     18         x = F.relu(self.conv3(x))
     19         x.view(-1, 32000)

D:\Users\user\Anaconda3\lib\site-packages\torch\nn\modules\module.py in __call__(self, *input, **kwargs)
    538             result = self._slow_forward(*input, **kwargs)
    539         else:
--> 540             result = self.forward(*input, **kwargs)
    541         for hook in self._forward_hooks.values():
    542             hook_result = hook(self, input, result)

D:\Users\user\Anaconda3\lib\site-packages\torch\nn\modules\conv.py in forward(self, input)
    346 
    347     def forward(self, input):
--> 348         return self._conv_forward(input, self.weight)
    349 
    350 class Conv3d(_ConvNd):

D:\Users\user\Anaconda3\lib\site-packages\torch\nn\modules\conv.py in _conv_forward(self, input, weight)
    343                             _pair(0), self.dilation, self.groups)
    344         return F.conv2d(input, weight, self.bias, self.stride,
--> 345                         self.padding, self.dilation, self.groups)
    346 
    347     def forward(self, input):

RuntimeError: Calculated padded input size per channel: (5 x 1). Kernel size: (1 x 50). Kernel size can't be greater than actual input size


I’m a bit confused as to why this is happening, as I have the tensor in the format (batch size, channels, height, and width), and I want the kernel to go down row by row. I’m not sure if this is the best approach for my project, and any further insight would be much appreciated!