mat1 dim 1 must match mat2 dim 0 - PyTorch
Im new to PyTorch and I keep getting the error mat1 dim1 must match mat1 dim0
this is my code for the network
class Net(Module):
    def __init__(self):
        super(Net, self).__init__()
        
        self.cnn_layers = Sequential(
            Conv1d(4,4,kernel_size=2, stride=1, padding=1),
            BatchNorm1d(4),
            ReLU(inplace=True),
            MaxPool1d(kernel_size=2,stride=1),
        )
        
        self.linear_layers = Sequential(
            Linear(8267*4,2)
        )
        
    def forward(self, x):
        print(x.shape)
        x = self.cnn_layers(x)
        print(x.shape)
        x = self.linear_layers(x)
        return x

and where the print statements are:
torch.Size([8267, 4, 1])
torch.Size([8267, 4, 1])

Any help/advice?

Assuming 8267 is your batch size. The output of your CNN is 8267x4x1. So you first need to flatten dim=1 and dim=2 into a single dimension to get a shape 8267x4. Then the following layer (dense) will require 4 neurons.
self.cnn_layers = Sequential(
    Conv1d(4, 4, kernel_size=2, stride=1, padding=1),
    BatchNorm1d(4),
    ReLU(inplace=True),
    MaxPool1d(kernel_size=2, stride=1))
    
self.linear_layers = Sequential(
    Flatten(),
    Linear(4, 2))

