nn.Conv2d layers expect a 4-dimensional input in the shape [batch_size, channels, height, width], while you are passing a 3-dimensional input in [1, 5, 50].
I would guess that one spatial or the channel dimension in missing in your input.
I’m not sure if dim1 (size 5) corresponds to the channels, as self.conv1 would then raise an error since it’s expecting a single input channel.
If your input is indeed in the shape [batch_size, channels, len], you should change in_channels=5 in the first conv layer and maybe use an nn.Conv1d, since you only have a temporal dimension in the input.
Unrelated to your error, but you would have to reassign the view to x via:
x = x.view(x.size(0), -1)

Note that I’ve slightly changed the view arguments, as my approach would keep the batch size and yield possible shape mismatch errors in the feature dimension, which would be easier to debug.