Skip to content

Commit

Permalink
(#7) Attack: Cast input to float32 and fix params
Browse files Browse the repository at this point in the history
  • Loading branch information
betarixm committed Apr 18, 2022
1 parent 220064a commit 541490c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/attack/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,10 @@ def add_perturbation(self, x: np.array) -> np.array:
class Pgd(Attack):
def add_perturbation(self, x: np.array) -> np.array:
return projected_gradient_descent(
self.victim_model.model(), x, 0.05, 0.01, 40, np.inf
self.victim_model.model(),
tf.cast(x, tf.float32),
8 / 255,
1 / 255,
10,
np.inf,
)

0 comments on commit 541490c

Please sign in to comment.