IntelLabs / MART

Modular Adversarial Robustness Toolkit
BSD 3-Clause "New" or "Revised" License
17 stars 0 forks source link

Update GradientModifier to be an in-place operation #123

Closed dxoigmn closed 1 year ago

dxoigmn commented 1 year ago

What does this PR do?

This PR updates GradientModifier to be an in-place operation like torch.nn.utils.clip_gradnorm. This also adds a test to make sure Adversary is properly modifying gradients.

Type of change

Please check all relevant options.

Testing

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

Before submitting

Did you have fun?

Make sure you had fun coding 🙃

dxoigmn commented 1 year ago

@mzweilin: I think it's better to merge this before the generic dispatch mechanism because it updates the tests.