The fourth dimension is the number of channels. Currently you only have batch size and x and y. You need to add the number of channels. To just do it simply in your forward function you can do this
def forward(self, x):
     x = x.unsqueeze(1)