I’m training a NN with Conv1d layers using DataLoader. Must data_loader’s batch_size = # of in_channels of first Conv1d layer? In my case, if it isn’t, I get matrix size mismatch errors.
Also, are there any tutorials on how to design convolutional NNs in PyTorch. I’m having trouble getting the in_channels and out_channels to be the correct sizes.
No, the batch size does not need to match the number of input channels of the first convolution as the nn.Conv1d layer expects input in the shape [batch_size, channels, seq_len].
If the shape mismatch is raised on the first linear layer, make sure the incoming input activation has the expected number of features (after fattening).