Not sure what im doing wrong, I can run a whole dataload through the model but if I try to pass one image in eval mode I get the error
expected stride to be a single integer value or a list of 1 values to match the convolution dimensions, but got stride=[1, 1]
x,y = train_dataset[7000] # Image 7,000 of 50,000
# CNN Model (2 conv layer)
class CNN(nn.Module):
def __init__(self):
super(CNN, self).__init__()
self.layer1 = nn.Sequential(
nn.Conv2d(1, 16, kernel_size=5, padding=2),
nn.BatchNorm2d(16),
nn.ReLU(),
nn.MaxPool2d(2))
self.layer2 = nn.Sequential(
nn.Conv2d(16, 32, kernel_size=5, padding=2),
nn.BatchNorm2d(32),
nn.ReLU(),
nn.MaxPool2d(2))
self.fc = nn.Linear(7*7*32, 10)
def forward(self, x):
out = self.layer1(x)
out = self.layer2(out)
out = out.view(out.size(0), -1)
out = self.fc(out)
return out
cnn = CNN()
cnn.eval() # Change model to 'eval' mode
cnn(x)