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: fixed np.sum in art/defences/postprocessor/gaussian_noise.py #1684

Merged
merged 1 commit into from
May 14, 2022

Conversation

GianlucaMega
Copy link

Signed-off-By: GianlucaMega megagianluca.mg@gmail.com

Description

The GaussianNoise postprocessing defence could not handle mini-batches due to a problem with the sums variable, in particular with the np.sum. The original instruction has been changed into np.sum(post_preds, axis=1, keepdims=True)

Fixes #1675

Type of change

Please check all relevant options.

  • Improvement (non-breaking)
  • Bug fix (non-breaking)
  • New feature (non-breaking)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Testing

Please describe the tests that you ran to verify your changes. Consider listing any relevant details of your test configuration.

  • tests/defences/test_gaussian_noise.py

Test Configuration:

  • OS Kali Linux 2022.1
  • Python version 3.9.7
  • ART version or commit number 1.10.2
  • TensorFlow / Keras / PyTorch / MXNet version TF:2.8.0, Keras:2.8.0, PyTorch:1.11.0+cu102, mx:1.8.0

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@beat-buesser beat-buesser self-assigned this May 12, 2022
@beat-buesser beat-buesser self-requested a review May 12, 2022 18:51
@beat-buesser beat-buesser added bug Something isn't working improvement Improve implementation labels May 12, 2022
@beat-buesser beat-buesser added this to the ART 1.10.2 milestone May 12, 2022
@codecov-commenter
Copy link

codecov-commenter commented May 12, 2022

Codecov Report

Merging #1684 (e50e827) into dev_1.10.2 (cb95baf) will increase coverage by 7.91%.
The diff coverage is 100.00%.

Impacted file tree graph

@@              Coverage Diff               @@
##           dev_1.10.2    #1684      +/-   ##
==============================================
+ Coverage       80.16%   88.08%   +7.91%     
==============================================
  Files             259      259              
  Lines           21349    21354       +5     
  Branches         3789     3791       +2     
==============================================
+ Hits            17114    18809    +1695     
+ Misses           3384     1599    -1785     
- Partials          851      946      +95     
Impacted Files Coverage Δ
art/defences/postprocessor/gaussian_noise.py 96.42% <100.00%> (ø)
art/defences/preprocessor/mp3_compression.py 84.05% <0.00%> (-5.01%) ⬇️
art/defences/detector/poison/activation_defence.py 84.28% <0.00%> (-0.34%) ⬇️
art/estimators/classification/tensorflow.py 84.48% <0.00%> (+0.41%) ⬆️
art/estimators/classification/scikitlearn.py 90.86% <0.00%> (+0.66%) ⬆️
art/attacks/attack.py 92.00% <0.00%> (+0.79%) ⬆️
art/utils.py 75.45% <0.00%> (+0.83%) ⬆️
art/attacks/evasion/boundary.py 93.97% <0.00%> (+1.20%) ⬆️
art/estimators/classification/keras.py 88.48% <0.00%> (+4.93%) ⬆️
art/attacks/evasion/iterative_method.py 100.00% <0.00%> (+9.09%) ⬆️
... and 18 more

@beat-buesser
Copy link
Collaborator

Hi @GianlucaMega Thank you very much for you pull request, that's amazing! May I ask you for one more step, could you please sign-off the commit to pass the DCO check? Follow these steps:

  1. Go to your local copy of your branch dev_1.10.2 where you created the commit
  2. Run git rebase HEAD~1 --signoff
  3. Force push your changes to overwrite your remote branch with git push --force-with-lease origin dev_1.10.2

Signed-off-by: GianlucaMega <megagianluca.mg@gmail.com>
@GianlucaMega
Copy link
Author

Sorry for the inconvenience, I've fixed it!

Copy link
Collaborator

@beat-buesser beat-buesser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @GianlucaMega Thank you very much for your help and congratulations to your first contribution to ART! Please let me know when you are interested in working on a new project for ART.

@beat-buesser beat-buesser merged commit 8549e0e into Trusted-AI:dev_1.10.2 May 14, 2022
@GianlucaMega
Copy link
Author

Thank you very much @beat-buesser for the support and guidance you gave me and congratulations for ART, amazing library!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working improvement Improve implementation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants