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

How to select the subset of input channels in each head? #9

Open
prstrive opened this issue Nov 28, 2020 · 1 comment
Open

How to select the subset of input channels in each head? #9

prstrive opened this issue Nov 28, 2020 · 1 comment

Comments

@prstrive
Copy link

Thanks for your perfect work! But in the paper, the input channels will be re-weighted by the SE block firstly. And then select the top-k subset to the normal convolution to get the output of each head. But your code just pass the whole re-weighted input channels to the normal convolution, whose shape is (C_out // num_heads, C_in, k, k). If so, the amount of calculation and parameters will not decrease. Therefore, I don't notice the select progress. Could you please explain to me?

@hellozhuo
Copy link
Owner

Yes, all the weights were passed to the normal convolution, but in these weights, some of them were assigned as 0. Please see https://github.com/zhuogege1943/dgc/blob/ba074863dc289f5875202288aa286ca22b94e15b/layers.py#L123
Those weights didn't contribute to the output. This is only convenient for training.
In testing, we can prune those 0 weight filters without affecting the results.

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

2 participants