Hi,
The error message is not very clear I’m afraid because it comes from deep within the C backend.
The problem here is that when you do a convolution on a 2D image with size (batch, in_chan, width, height), and you want an output of size (batch, out_chan, width’, height’), your weights for the convolution should be (out_chan, in_chan, width_kern_size, height_kern_size), basically when you use a kernel size of 5 for the Conv2d function, it is the same as having a kernel of width 5 and height 5.
Thus you should have self.w_conv1 = Variable(torch.randn(32, 1, 5, 5)). See the doc 96 for more details.