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

替换mobilenetv2的分组卷积报错 #7

Open
H-WU opened this issue Jan 5, 2021 · 2 comments
Open

替换mobilenetv2的分组卷积报错 #7

H-WU opened this issue Jan 5, 2021 · 2 comments

Comments

@H-WU
Copy link

H-WU commented Jan 5, 2021

当替换分组卷积时,weight的维度和group的维度不对应。
RuntimeError: Given groups=1024, expected weight to be at least 1024 at dimension 0, but got weight of size [32, 32, 3, 3] instead
aggregate_weight = torch.mm(softmax_attention, weight).view(-1, self.in_planes, self.kernel_size, self.kernel_size)
这一行应改成下面这样
aggregate_weight = torch.mm(softmax_attention, weight).view(-1, self.in_planes//self.groups, self.kernel_size, self.kernel_size)

@kaijieshi7
Copy link
Owner

谢谢你的发现

@Tengfei000
Copy link

当替换分组卷积时,weight的维度和group的维度不对应。 RuntimeError: Given groups=1024, expected weight to be at least 1024 at dimension 0, but got weight of size [32, 32, 3, 3] instead aggregate_weight = torch.mm(softmax_attention, weight).view(-1, self.in_planes, self.kernel_size, self.kernel_size) 这一行应改成下面这样 aggregate_weight = torch.mm(softmax_attention, weight).view(-1, self.in_planes//self.groups, self.kernel_size, self.kernel_size)

MobileNetV2替换动态卷积的结果你测了吗 我这边测试有较大的下降

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