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

[bug] z.shape Q.shape is not same in graphlayer #5

Open
wdp-007 opened this issue Aug 2, 2020 · 5 comments
Open

[bug] z.shape Q.shape is not same in graphlayer #5

wdp-007 opened this issue Aug 2, 2020 · 5 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@wdp-007
Copy link

wdp-007 commented Aug 2, 2020

image
in the code above:
z shape is (self.batch, self.d , self.htself.wdth , self.no_of_vert)
while Q shape is (self.batch, self.ht
self.wdth, self.d , self.no_of_vert)
When the code is executed to z = torch.mul(z,Q), an error will be reported

@vidit98
Copy link
Owner

vidit98 commented Aug 2, 2020

Hi, the shape of Q is (B, HW, V) and that of Z is (B, d, HW, V). So when torch.mul(Z,Q) is used, output shape will be (B,d, HW, V). You can try it with some random vectors this should not report an error. Did you face any such error while running the code?

@wdp-007
Copy link
Author

wdp-007 commented Aug 2, 2020

yes, there reports this error when I run the code :
image
we can see that the shape of z is [4, 2048, 4096, 2], while Q is [4, 4096, 2].
I replace func GraphProject_optim with GraphProject, this error disappear

@wdp-007
Copy link
Author

wdp-007 commented Aug 2, 2020

Another question, I encounter this error:
image
so I move the conv1 before upsample
image
I wonder why put the conv1 affter upsample?

@vidit98
Copy link
Owner

vidit98 commented Aug 2, 2020

Regarding torch.mul(z,Q) I realized it will throw an error if batch size if greater than 1. Thanks for pointing it out. You can reshape Q as (B, 1, HW, V) to get rid of the error. GraphProject function is just a non vectorized version of same thing.

Final conv1 it the one which makes projects the channel to the number of classes. Please go through the paper mentioned in the readme. If you remove the conv1 it might result in an error or give wrong results.
The error regarding memory will go if you reduce your batch size, you can try it with batch size = 1. The code needs to be optimized further to make it more memory efficient.

@vidit98 vidit98 added the bug Something isn't working label Aug 2, 2020
@vidit98
Copy link
Owner

vidit98 commented Aug 2, 2020

Another small thing, in file graphLayer.py in line 193 you need to change Z(capital Z) to z(small z) in torch.div(Z, norm).

@vidit98 vidit98 added the good first issue Good for newcomers label Aug 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants