IliaZenkov/transformer-cnn-emotion-recognition

RuntimeError: mat1 dim 1 must match mat2 dim 0

jvel07 opened this issue · 2 comments

Hi, congrats on the project!
I am getting this error, could not figure out what's going on:

File "/media/user/hk-data/PycharmProjects/dnn_embeddings_pytorch/train_model.py", line 148, in train_model
output = net(x_train)
File "/home/user/anaconda3/envs/general_py37/lib/python3.7/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(*input, **kwargs)
File "/media/user/hk-data/PycharmProjects/dnn_embeddings_pytorch/dnn_models.py", line 240, in forward
output_logits = self.fc1_linear(complete_embedding)
File "/home/user/anaconda3/envs/general_py37/lib/python3.7/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/user/anaconda3/envs/general_py37/lib/python3.7/site-packages/torch/nn/modules/linear.py", line 93, in forward
return F.linear(input, self.weight, self.bias)
File "/home/user/anaconda3/envs/general_py37/lib/python3.7/site-packages/torch/nn/functional.py", line 1690, in linear
ret = torch.addmm(bias, input, weight.t())
RuntimeError: mat1 dim 1 must match mat2 dim 0

I actually found out why. It is due to the shape of my MFCCs. The shape I have is (1, 40, 498).
In your case, it is (1, 40, 282). How could I adapt to the shape of my MFCCs?