Your code is a bit hard to follow because you did not paste it correctly. That being said I think I found your error. When you define your CNN module you set your input_size parameter to have a default size of 1 as seen below:

class CNN(nn.Module):
def init (
self,
input_size = 1,
hid_size = 256,
kernel_size = 5,
num_classes = 5,
):

Then when you initialize your model:



 hs99:

model_1 = CNN(num_classes=5, hid_size=128).to(device)


you don’t tell it what input_size you want so it uses the default, which is 1.
Hence your model expected 1 input channel in the first conv1d, but it got 32.
Change your CNN initialization to

model_1 = CNN(num_classes=5, hid_size=128, input_size = 32).to(device)

hope that helps