This code work well, no problem.
However I have a question because The size of the image is not divisible by the kernel.
(Conv2d in pytorch on colab.)
The code is here https://github.com/YutaroOgawa/Qiita/blob/master/MNIST_IIC.ipynb
I could see the size,
torch.Size([512, 1, 28, 28])
This code was added by myself.
[for data, target in train_loader:
print(data.size())]
And the first conv2d layer is
self.conv1 = nn.Conv2d(1, 128, 5, 2, bias=False)
Therefore, the output pixels are calculated by
output pixel = (pixel - kernel size) / stride + 1
but (28 - 5) / 2 become odd and could not divisible.
I couldn’t understand this.
Thank you for reading.