Skip to content

Commit

Permalink
Fix Numpy typing
Browse files Browse the repository at this point in the history
Signed-off-by: Beat Buesser <[email protected]>
  • Loading branch information
beat-buesser committed Dec 17, 2024
1 parent 093b8fd commit 005c45b
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ def _random_overlay(
mask_2d[:, -edge_w_1:] = False

Check warning on line 394 in art/attacks/evasion/adversarial_patch/adversarial_patch_pytorch.py

View check run for this annotation

Codecov / codecov/patch

art/attacks/evasion/adversarial_patch/adversarial_patch_pytorch.py#L394

Added line #L394 was not covered by tests

num_pos = np.nonzero(mask_2d.int())
pos_id = np.random.choice(num_pos.shape[0], size=1, replace=False)
pos_id = np.random.choice(num_pos.shape[0], size=1, replace=False) # type: ignore
pos = num_pos[pos_id[0]]

Check warning on line 398 in art/attacks/evasion/adversarial_patch/adversarial_patch_pytorch.py

View check run for this annotation

Codecov / codecov/patch

art/attacks/evasion/adversarial_patch/adversarial_patch_pytorch.py#L396-L398

Added lines #L396 - L398 were not covered by tests
y_shift = pos[0] - self.image_shape[self.i_h] // 2
x_shift = pos[1] - self.image_shape[self.i_w] // 2

Check warning on line 400 in art/attacks/evasion/adversarial_patch/adversarial_patch_pytorch.py

View check run for this annotation

Codecov / codecov/patch

art/attacks/evasion/adversarial_patch/adversarial_patch_pytorch.py#L400

Added line #L400 was not covered by tests
Expand Down

0 comments on commit 005c45b

Please sign in to comment.