Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeError: mat1 dim 1 must match mat2 dim 0 #44

Open
AminAnsarian opened this issue Mar 5, 2021 · 1 comment
Open

RuntimeError: mat1 dim 1 must match mat2 dim 0 #44

AminAnsarian opened this issue Mar 5, 2021 · 1 comment

Comments

@AminAnsarian
Copy link

I get this error with this Traceback when trying to train non-local on ground truth h36m:

Traceback (most recent call last):

File "/mnt/466a95be-9c12-4e2c-9e95-7d037205b249/Amin/SemGCN/main_gcn.py", line 287, in
main(parse_args())

File "/mnt/466a95be-9c12-4e2c-9e95-7d037205b249/Amin/SemGCN/main_gcn.py", line 176, in main
epoch_loss, lr_now, glob_step = train(train_loader, model_pos, criterion, optimizer, device, args.lr, lr_now,

File "/mnt/466a95be-9c12-4e2c-9e95-7d037205b249/Amin/SemGCN/main_gcn.py", line 223, in train
outputs_3d = model_pos(inputs_2d)

File "/home/amin/anaconda3/envs/torch/lib/python3.8/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(*input, **kwargs)

File "/mnt/466a95be-9c12-4e2c-9e95-7d037205b249/Amin/SemGCN/models/sem_gcn.py", line 93, in forward
out = self.gconv_input(x)

File "/home/amin/anaconda3/envs/torch/lib/python3.8/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(*input, **kwargs)

File "/home/amin/anaconda3/envs/torch/lib/python3.8/site-packages/torch/nn/modules/container.py", line 117, in forward
input = module(input)

File "/home/amin/anaconda3/envs/torch/lib/python3.8/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(*input, **kwargs)

File "/mnt/466a95be-9c12-4e2c-9e95-7d037205b249/Amin/SemGCN/models/sem_gcn.py", line 23, in forward
x = self.gconv(x).transpose(1, 2)

File "/home/amin/anaconda3/envs/torch/lib/python3.8/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(*input, **kwargs)

File "/mnt/466a95be-9c12-4e2c-9e95-7d037205b249/Amin/SemGCN/models/sem_graph_conv.py", line 43, in forward
output = torch.matmul(adj * M, h0) + torch.matmul(adj * (1 - M), h1)

RuntimeError: mat1 dim 1 must match mat2 dim 0

and these are the input parameters:
Using settings Namespace(actions='*', batch_size=64, checkpoint='checkpoint', dataset='h36m', downsample=1, dropout=0.0, epochs=100, evaluate='', hid_dim=128, keypoints='gt', lr=0.001, lr_decay=100000, lr_gamma=0.96, max_norm=True, non_local=True, num_layers=4, num_workers=8, resume='', snapshot=5)

the matrix multiplication dimensions are not matching apparently:

adj is 16x16
M is 16x16

and h0 is 64x17x128.

Does anybody know how to fix this? Thanks in advance!

@koustav123
Copy link

For me, it was due to using preprocessed npz files from another repository (VideoPose3D). I instead downloaded a fresh zip file and ran the processing script and now it works all right.

Check here.
https://github.com/garyzhao/SemGCN/tree/master/data

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants