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

Errror when using train_asmlp_b.sh #1

Closed
HantingChen opened this issue Jul 21, 2021 · 3 comments
Closed

Errror when using train_asmlp_b.sh #1

HantingChen opened this issue Jul 21, 2021 · 3 comments

Comments

@HantingChen
Copy link

When using train_asmlp_b.sh, the above error occurs:

File "/home/ma-user/work/AS-MLP-main/models/as_mlp.py", line 165, in forward
x = shortcut + self.drop_path(x)
File "/home/ma-user/anaconda3/envs/Pytorch-1.4.0/lib/python3.6/site-packages/apex/amp/wrap.py", line 58, in wrapper
return orig_fn(*new_args, **kwargs)
RuntimeError: The size of tensor a (56) must match the size of tensor b (60) at non-singleton dimension 3

@wp2333
Copy link

wp2333 commented Jul 21, 2021

I get this error too. did you solve it?

@HantingChen
Copy link
Author

I get this error too. did you solve it?

I am trying to fix it. It seems that the AxialShift block changes the size (

x = self.axial_shift(x) # nW*B, window_size*window_size, C
).

They pad the input (

x = F.pad(x, (self.pad, self.pad, self.pad, self.pad) , "constant", 0)
) but without shrinking it.

image

@niujinshuchong
Copy link
Collaborator

@HantingChen @wp2333
Thanks for pointing this. Yes, we should comment this line https://github.com/svip-lab/AS-MLP/blob/main/models/as_mlp.py#L70.

I updated the code and it should solve this error.

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

3 participants