chinhsuanwu/coatnet-pytorch

An error occurs when an image of 512 size is given as input.

Closed this issue · 2 comments

Hello.I really aprreciate for your project.

However, The following error occurs when a 512-size image is input at Attention class.

dots = dots + relative_bias
RuntimeError: The size of tensor a (1024) must match the size of tensor b (196) at non-singleton dimension 3.

dots = dots + relative_bias

Why this error is occured? How do I edit your code when I want to resize the image?

Thank you!

Hi @jeongHwarr

If you are not using images with size 224x224, you should modify the first argument in CoAtNet.
For example,

net = CoAtNet((512, 512), 3, num_blocks, channels, num_classes=1000)

@chinhsuanwu Oh.. my.. I forgot that! I really really thank you so much! Have a good day. Thank you for your contribution!