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: shape '[64, 49, 3, 3, 21]' is invalid for input of size 602112 #7

Open
Riyone opened this issue Jul 12, 2022 · 2 comments

Comments

@Riyone
Copy link

Riyone commented Jul 12, 2022

Hello, I try to only use "backbones/davit.py" models, and i use a torch.randn((1,3,224,224)) as a picture input for testing. When it runs to"qkv = self.qkv(x).reshape(B_, N, 3, self.num_heads, C // self.num_heads).permute(2, 0, 3, 1, 4)" (class WindowAttention). I got an error....
Uploading 123.png…

Is there any requirement for the image format, or is there anything else I missed?

@Riyone
Copy link
Author

Riyone commented Jul 12, 2022

Alright, i guess it's because initialized embed_dims cannot divide num_heads evenly.

@dc250601
Copy link

dc250601 commented Jul 16, 2022

We have to initialize embed_dims as (96, 192, 384, 768); this is the default mentioned in the paper. I don't know why the code has it initialized differently. Even the Swin paper uses the same config, so it feels more natural.

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