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 unsupported operand type(s) for / error in AdversarialPatch in Tensorflow #2276

Merged
merged 2 commits into from
Sep 13, 2023

Conversation

deepakupman
Copy link
Contributor

Description

The error occurred in the file "adversarial_patch_tensorflow.py" at line 277. The error message indicated that there was an unsupported operand type for division (/) between a 'Dimension' and an 'int', and it suggested using '//' instead.

To resolve this issue, I added the .as_list() method to the TensorFlow tensor's shape attribute.

Fixes #2273

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.

  • [x ] Tested AdversarialPatchTensorFlowV2

Test Configuration:

  • OS
  • Python version
  • ART version or commit number
  • TensorFlow / Keras / PyTorch / MXNet version

Checklist

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

@beat-buesser beat-buesser self-assigned this Sep 12, 2023
@beat-buesser beat-buesser self-requested a review September 12, 2023 14:56
@beat-buesser beat-buesser added bug Something isn't working improvement Improve implementation labels Sep 12, 2023
@beat-buesser beat-buesser added this to the ART 1.15.2 milestone Sep 12, 2023
@beat-buesser beat-buesser changed the title Dev 1.16.0 Fix unsupported operand type(s) for / error in AdversarialPatch in Tensorflow Sep 12, 2023
@beat-buesser beat-buesser changed the base branch from dev_1.16.0 to dev_1.15.2 September 12, 2023 14:57
@beat-buesser beat-buesser changed the base branch from dev_1.15.2 to dev_1.16.0 September 12, 2023 14:57
@beat-buesser beat-buesser modified the milestones: ART 1.15.2, ART 1.16.0 Sep 12, 2023
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 @deepakupman Thank you very much and congratulations to your first accepted pull request into ART!

@codecov-commenter
Copy link

codecov-commenter commented Sep 12, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.80%. Comparing base (161c406) to head (f015029).

Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff               @@
##           dev_1.16.0    #2276      +/-   ##
==============================================
+ Coverage       83.87%   85.80%   +1.92%     
==============================================
  Files             318      318              
  Lines           28329    28329              
  Branches         5157     5157              
==============================================
+ Hits            23761    24307     +546     
+ Misses           3243     2709     -534     
+ Partials         1325     1313      -12     
Files with missing lines Coverage Δ
.../adversarial_patch/adversarial_patch_tensorflow.py 81.04% <100.00%> (ø)

... and 17 files with indirect coverage changes

@beat-buesser beat-buesser merged commit ee1fda8 into Trusted-AI:dev_1.16.0 Sep 13, 2023
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
3 participants