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

Fix masking with more than one input feature #158

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jglaser
Copy link
Contributor

@jglaser jglaser commented Aug 14, 2022

This PR fixes an issue where passing inputs x1 and x2 of dimension (..., n_feat) with n_feat > 1 to a kernel_fn generates masks in the Kernel which still carry the original feature dimension.

This creates a problem for layers such as GlobalAvgPool, since for kernels that represent infinitely wide layers it is generally assumed that the channel dimension is one.

I implemented a reduction over the mask's last dimension using np.any(.., keepdims=True), which assumes that it doesn't matter if any or all of the features are masked. A user warning spells this out.

I can create an issue with a reproducer shortly, if more detail is needed. Can also add a unit test.

@romanngg
Copy link
Contributor

Thanks a lot Jens, could you share a code sample that would fail before this change? I think we should support n_feat > 1, so I wonder if this points to a bug that needs to be fixed elsewhere.

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

Successfully merging this pull request may close these issues.

2 participants