nnzhan / MTGNN

MIT License
798 stars 222 forks source link

Incorrect multiplication order for einsum when aggregating adjacent node information. (vw -> wv) #9

Closed ntubiolin closed 4 years ago

ntubiolin commented 4 years ago

Hi! I like your great work! But I have one question when reading your source code:

https://github.com/nnzhan/MTGNN/blob/d9d4235433a0395768599471977c64c54bff40ea/layer.py#L14

Should the above code be changed into x = torch.einsum('ncvl,wv->ncwl',(x,A)) so that it would be consistent with the definition in https://github.com/nnzhan/MTGNN/blob/d9d4235433a0395768599471977c64c54bff40ea/layer.py#L45 (every row in the adjacent matrix sum up to 1)?

Thanks!

nnzhan commented 4 years ago

Hi thanks for your comment, I think you are right. After further investigation, I will correct it.

ntubiolin commented 4 years ago

OK, thanks!

lorrp1 commented 4 years ago

@ntubiolin @nnzhan hello, im getting this error:

return _VF.einsum(equation, operands)
RuntimeError: size of dimension does not match previous size, operand 1, dim 0

in

 MTGNN-master/layer.py", line 14, in forward
    x = torch.einsum('ncvl,vw->ncwl',(x,A))

have you got any idea on how i could solve it?

nnzhan commented 3 years ago

@lorrp1 Can you print out the shape of X and A?

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

PavanPasidu commented 2 weeks ago

@zhp66 Were you able to solve this?