Skip to content

Commit

Permalink
mypy fixes
Browse files Browse the repository at this point in the history
Signed-off-by: GiulioZizzo <[email protected]>
  • Loading branch information
GiulioZizzo committed Nov 30, 2023
1 parent 4bb4139 commit 48391d1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion art/experimental/attacks/evasion/fast_gradient.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,10 @@ def _minimal_perturbation(self, x: np.ndarray, y: np.ndarray, mask: np.ndarray)
:param y: Target values (class labels) one-hot-encoded of shape (nb_samples, nb_classes).
:return: An array holding the adversarial examples.
"""
adv_x = copy.deepcopy(x)
partial_stop_condition: Union[bool, np.ndarray, np.bool_]
current_eps: Union[int, float, np.ndarray]

adv_x = copy.deepcopy(x)
# Compute perturbation with implicit batching
for batch_id in range(int(np.ceil(adv_x.shape[0] / float(self.batch_size)))):
batch_index_1, batch_index_2 = (
Expand Down Expand Up @@ -268,6 +270,10 @@ def _compute(
decay: Optional[float] = None,
momentum: Optional[np.ndarray] = None,
) -> np.ndarray:

batch_eps: Union[int, float, np.ndarray]
batch_eps_step: Union[int, float, np.ndarray]

if random_init:
n = x.shape[0]
m = np.prod(x.shape[1:]).item()
Expand Down

0 comments on commit 48391d1

Please sign in to comment.