megvii-research / RevCol

Official Code of Paper "Reversible Column Networks" "RevColv2"
Apache License 2.0
246 stars 10 forks source link

size mismatch testing revcol_tiny #5

Closed Nurfen closed 1 year ago

Nurfen commented 1 year ago

Hi, congrats on the paper!

I tried testing the code but I get the following error running the below test code:

RuntimeError: The size of tensor a (4) must match the size of tensor b (5) at non-singleton dimension 3

from models.revcol import revcol_tiny
import torch
nt = revcol_tiny(True, num_classes=10)
a = torch.ones([1,3,40,40])
out = nt.forward(a)
print(out.shape)
nightsnack commented 1 year ago

Ah I know what happened. Typically ImageNet image input is a multiple of 32, cause the network is gradually down-sample the input. i.e. input size is 224x224, then 56x56, 28x28, 14x14, 7x7。If you violate this constraint, the up-sample layer will report an error.