Skip to content

Commit d472a6e

Browse files
committed
Fix missing perturbation update stage 2
This bug was introduced while wrapping up PR 719. The gradient descrent steps for loss theta and loss net were previously separated and merged into one line. During that simplifiation of the gradient descent, the perturbation update was lost. Signed-off-by: Hessel Tuinhof <[email protected]>
1 parent 87fcd6e commit d472a6e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

art/attacks/evasion/imperceptible_asr/imperceptible_asr.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,10 +254,12 @@ def _create_imperceptible(self, x: np.ndarray, x_adversarial: np.ndarray, y: np.
254254
if x.ndim != 1:
255255
alpha = np.expand_dims(alpha, axis=-1)
256256

257-
perturbation = x_adversarial - x
258257
x_perturbed = x_adversarial.copy()
259258

260259
for i in range(self.max_iter_2):
260+
# get perturbation
261+
perturbation = x_perturbed - x
262+
261263
# get loss gradients of both losses
262264
gradients_net = self.estimator.loss_gradient(x_perturbed, y, batch_mode=True)
263265
gradients_theta, loss_theta = self._loss_gradient_masking_threshold(perturbation, x)

0 commit comments

Comments
 (0)