lightaime / deep_gcns_torch

Pytorch Repo for DeepGCNs (ICCV'2019 Oral, TPAMI'2021), DeeperGCN (arXiv'2020) and GNN1000(ICML'2021): https://www.deepgcns.org
MIT License
1.14k stars 155 forks source link

RuntimeError: size mismatch, m1: [2339 x 100], m2: [20 x 256] at /opt/conda/conda-bld/pytorch_1556653215914/work/aten/src/THC/generic/THCTensorMathBlas.cu:268 #12

Closed miaoshuyu closed 4 years ago

miaoshuyu commented 4 years ago

When I train the model as "python -u examples/ppi/main.py --phase train --data_dir /data/deepgcn/ppi" I meet the issue that: ===> Loading the network ... ===> loading pre-trained ... ===> No pre-trained model ===> Init the optimizer ... ===> Init Metric ... ===> Start training ... Traceback (most recent call last): File "/home/msy/project/deep_gcns_original/examples/ppi/main.py", line 77, in train_step out = model(data) File "/home/msy/anaconda3/envs/torch_1.2/lib/python3.7/site-packages/torch/nn/modules/module.py", line 493, in call result = self.forward(*input, kwargs) File "/home/msy/project/deep_gcns_original/examples/ppi/architecture.py", line 49, in forward feats = [self.head(x, edge_index)] File "/home/msy/anaconda3/envs/torch_1.2/lib/python3.7/site-packages/torch/nn/modules/module.py", line 493, in call result = self.forward(*input, *kwargs) File "/home/msy/project/deep_gcns_original/gcn_lib/sparse/torch_vertex.py", line 183, in forward return self.gconv(x, edge_index) File "/home/msy/anaconda3/envs/torch_1.2/lib/python3.7/site-packages/torch/nn/modules/module.py", line 493, in call result = self.forward(input, kwargs) File "/home/msy/project/deep_gcns_original/gcn_lib/sparse/torch_vertex.py", line 22, in forward return self.nn(torch.cat([x, x_j], dim=1)) File "/home/msy/anaconda3/envs/torch_1.2/lib/python3.7/site-packages/torch/nn/modules/module.py", line 493, in call result = self.forward(*input, *kwargs) File "/home/msy/anaconda3/envs/torch_1.2/lib/python3.7/site-packages/torch/nn/modules/container.py", line 92, in forward input = module(input) File "/home/msy/anaconda3/envs/torch_1.2/lib/python3.7/site-packages/torch/nn/modules/module.py", line 493, in call result = self.forward(input, **kwargs) File "/home/msy/anaconda3/envs/torch_1.2/lib/python3.7/site-packages/torch/nn/modules/linear.py", line 92, in forward return F.linear(input, self.weight, self.bias) File "/home/msy/anaconda3/envs/torch_1.2/lib/python3.7/site-packages/torch/nn/functional.py", line 1406, in linear ret = torch.addmm(bias, input, weight.t()) RuntimeError: size mismatch, m1: [2339 x 100], m2: [20 x 256] at /opt/conda/conda-bld/pytorch_1556653215914/work/aten/src/THC/generic/THCTensorMathBlas.cu:268.

How can i solve it?

guochengqian commented 4 years ago

Hello. I cannot reproduce your error. I use the same code as you but it runs correctly. Are you sure that you have pulled the newest code?

guochengqian commented 4 years ago

I will close this. Just pull the newest code and it should work fine. Feel free to reopen if it cannot solve your problem.