A 2D layer, e.g. nn.Conv2d, expects the input to have the shape [batch_size, channels, height, width].
The in_channels of the first conv layer correspond to the channels in your input.
Based on the definition of self.cnn1 it seems you want to pass an input with a single channel, so you might want to call x = x.unsqueeze(1) to create the channel dimension.
This would only work, if your current input is defined as [batch_size, height, width].