Validate point-wise torch activation in eMLP and iMLP#15
Draft
Validate point-wise torch activation in eMLP and iMLP#15
Conversation
Co-authored-by: Danfoa <8356912+Danfoa@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add dynamic check for point-wise non-linearities in eMLP and iMLP
Validate point-wise torch activation in eMLP and iMLP
Feb 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
eMLPandiMLPsilently accepted anytorch.nn.Moduleasactivation, including non-point-wise modules that break equivariance. Add an elegant, forward-compatible guard that rejects anything that isn't a torch point-wise activation.Changes
_is_torch_pointwise_activation(module)— new module-level helper inemlp.py. Checkstype(module).__module__ == "torch.nn.modules.activation", which covers every current and future activation in PyTorch's dedicated activation namespace without any manual enumeration.eMLP.__init__— replaces bareassert isinstance(activation, torch.nn.Module)with aValueErrorusing the helper.iMLP.__init__— adds the same guard (previously no activation type check existed).ValueErrorwith a message containing the offending type name.Original prompt
Created from VS Code.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.