Hi ! I have problem with my CNN model. I don’t understand why my model works for summary when I give (1, 64, 16) and why it doesn’t work for real input ( it is batch, so it is tensor of inputs (256, 1, 64, 16)). I use torch.utils.data.DataLoader.
Summary:

Error:
RuntimeError: mat1 and mat2 shapes cannot be multiplied (256x320 and 640x8)
and it goes ahead in this line: self.fc1 = nn.Linear(64 * 5 * 2 , 8)

Can someone help me with this? Could you explain me, how solve this problem ? Thank you !

@InnovArul Thank you for your help. I found mistake. It was in pre-processing data. In your example, you used d = torch.randn(256, 1, 64, 16) but what if I will use d = torch.randn(1, 64, 16), I know it will be probably error. It is possible use single tensor (1, 64, 16) if I trained model with batch (256, 1, 64, 16) ?

The nn modules are written to work on batches of data. i.e., they expect a batch dimension at 0’th position. To pass one data point, you can use batch dimension with size 1. i.e., data of size (1, 1, 64, 16).