-
Notifications
You must be signed in to change notification settings - Fork 2
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
Add LRP model checks and support unknown layers via AD fallback #26
Merged
Conversation
This file contains 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
Codecov Report
@@ Coverage Diff @@
## master #26 +/- ##
==========================================
- Coverage 95.73% 90.95% -4.78%
==========================================
Files 8 9 +1
Lines 164 199 +35
==========================================
+ Hits 157 181 +24
- Misses 7 18 +11
Continue to review full report at Codecov.
|
Only needs some updated doc strings and documentation! |
adrhill
changed the title
Add
Add LRP model checks and support unknown layers via AD fallback
Mar 3, 2022
check_model
This was referenced Mar 10, 2022
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.
closes #25
Model checks
Adds the
check_model(:LRP, model)
function to check models for compatibility with LRP. This function is called by default in the constructor of all LRP analyzers and returns a summary using PrettyTables.jl (shown in screenshots below).These checks can be fully skipped using the LRP analyzer keyword argument
skip_checks
for users who know what they are doing. Alternatively, individual custom layers and activation functions can be registered:Custom layer support
This registration mechanism opens up the possibility to define LRP rules on custom layers.
For this purpose, type restrictions on the default automatic differentiation fallback have been removed.
By default, the following AD fallback will be applied to registered but unknown layers:
Where by default
modify_layer(rule, layer) = layer
andmodify_denominator(rule, z) = stabilize_denom(d; eps=1.0f-9)
. These can be extended by the user for any combination of rule and custom layer.The user can also use multiple dispatch to implement fully custom rules using this interface:
Screenshots
Unknown/unsupported activation function
Unknown layer