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

ValueError: Expected more than 1 value per channel when training, got input size torch.Size([1, 256, 1, 1]) #43

Open
war0927 opened this issue Oct 13, 2023 · 2 comments

Comments

@war0927
Copy link

war0927 commented Oct 13, 2023

我采用你的方法进行特征融合,
nn.AdaptiveAvgPool2d(1),
nn.Conv2d(channels, inter_channels, kernel_size=1, stride=1, padding=0),
nn.BatchNorm2d(inter_channels),
nn.ReLU(inplace=True),
nn.Conv2d(inter_channels, channels, kernel_size=1, stride=1, padding=0),
nn.BatchNorm2d(channels),
第一行将自适应池化的输出按照原文设为1时会报错ValueError: Expected more than 1 value per channel when training, got input size torch.Size([1, 256, 1, 1]),请问有解决办法吗。

@Xj1567589354
Copy link

这种维度不匹配的问题就不要问了咯,对齐维度不就好了,这种低级错误

@liyiersan
Copy link

batch size设置为1,使用BN层没有意义,把Batch size改为大于1即可。

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