conv1D parameters

Hi! I am trying to use 1D convolution in order to classify a set of time signals. Every data unit I need to classify is made out of 65 different time series, each one contains 50 time samples, so if I write:

dataset = MyDataset(train,y_train_one_hot)
a,b = dataset[1]

I will get: [56,50].

I want to run 1D convolutional filters on each one of the channels. Problem is I cant get right the inputs of the first nn.Conv1d layer - right now I am using:

self.c1 = nn.Conv1d(in_channels=56 , out_channels=100 , kernel_size=ks1)

but when I run the model with a batch size of 100, the input becomes of the shape [100,56,50] and I get only one prediction for a batch size of 100 (instead of 100X3). Can anyone help with the right syntax? Thank you very much!

I guess you are reshaping the activation in the forward method of your model and might change the batch size to 1. If you are using x = x.view(-1, SHAPE) to flatten the tensor, then replace it with x = x.view(x.size(0), -1) which will keep the batch size and might raise a valid shape mismatch error in another layer.

That was indeed the case, I wasn’t using reshape the right way (didn’t know about view).
Thank you very much!