nnzhan / MTGNN

MIT License
762 stars 216 forks source link

layer.py #18

Open zhp66 opened 3 years ago

zhp66 commented 3 years ago

@ntubiolin @nnzhan Hello,I had the same problem return torch._C._VariableFunctions.einsum(equation, operands) RuntimeError: size of dimension does not match previous size, operand 1, dim 1 in MTGNN-master/layer.py", line 14, in forward x = torch.einsum('ncvl,vw->ncwl',(x,A)) and I printed out the shapes of X and A torch.Size([64, 32, 206, 13]) torch.Size([207, 207]) I'm using the METR-LA dataset

nnzhan commented 3 years ago

Can you provide the script you run the code?

1018594417 commented 3 years ago

I met the same problem with zhp66, as the iter came to 600 , Traceback (most recent call last): File "train_single_step.py", line 220, in val_acc, val_rae, val_corr, test_acc, test_rae, test_corr = main() File "train_single_step.py", line 182, in main args.batch_size) File "train_single_step.py", line 27, in evaluate output = model(X) File "C:\Users\10185\anaconda3\envs\pytorch\lib\site-packages\torch\nn\modules\module.py", line 547, in call result = self.forward(*input, kwargs) File "C:\Users\10185\PycharmProjects\mt\MTGNN-master\net.py", line 121, in forward x = self.gconv1[i](x, adp)+self.gconv2[i](x, adp.transpose(1,0)) File "C:\Users\10185\anaconda3\envs\pytorch\lib\site-packages\torch\nn\modules\module.py", line 547, in call result = self.forward(*input, *kwargs) File "C:\Users\10185\PycharmProjects\mt\MTGNN-master\layer.py", line 72, in forward h = self.alphax + (1-self.alpha)self.nconv(h,a) File "C:\Users\10185\anaconda3\envs\pytorch\lib\site-packages\torch\nn\modules\module.py", line 547, in call result = self.forward(input, kwargs) File "C:\Users\10185\PycharmProjects\mt\MTGNN-master\layer.py", line 14, in forward x = torch.einsum('ncwl,vw->ncvl',(x,A)) File "C:\Users\10185\anaconda3\envs\pytorch\lib\site-packages\torch\functional.py", line 202, in einsum return torch._C._VariableFunctions.einsum(equation, operands) RuntimeError: size of dimension does not match previous size, operand 1, dim 1