Closed Rubinjo closed 1 year ago
Thanks for the contribution, this looks good!
Could you add your example to the package tests, e.g. by adding a new file tests/backend/test_layer_idx.py
?
I have added a basic test similar to the example I discussed in my previous comment.
Looks good to me and tests passed locally. Thanks! :)
Fixes the
is_layer_at_idx
function by binding the loop variablei
to the lambda function and looping through the model's layers to find the corresponding index.Closes #264
Example of fix
I have used a simple CNN network to test the implementation, see below the model summary.
I used the following LRP settings.
For verification, I printed the rule object and the layer it will be applied to.
As you can see all three rules are being applied.
Discussion
The
until_layer_idx
argument will now count every layer in your model, also Input, Reshape, Pooling, etc.