-
Notifications
You must be signed in to change notification settings - Fork 81
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 deal with the conv in SE module? #54
Comments
same question |
any updates? |
Looking forward your reply, any suggestions? @keyu-tian |
@RainFrost1 @will1973 @yxchng SE module contains two linear layers (channel-wise) and one global average pooling. No changes required to the linear layers. As for the global pooling on a masked feature map, one should calculate the mean value at unmasked positions only. To implement this you can use our function class SparseGlobalAveragePooling(nn.Module):
def forward(self, x): # shape: BCHW
B, C, H, W = x.shape
unmasked_positions = _get_active_ex_or_ii(H=H, W=W, returning_active_ex=True) # shape: B1HW
mean = (x * unmasked_positions).sum(dim=(2,3), keepdims=True) / unmasked_positions.sum(dim=(2,3), keepdims=True)
return mean # shape: BC11 |
No description provided.
The text was updated successfully, but these errors were encountered: