Skip to content

Commit c7e0c1e

Browse files
Irina NicolaeIrina Nicolae
authored andcommitted
Merge branch 'dev' of github.ibm.com:nemesis/nemesis into dev
2 parents 76cfe9d + b399f2e commit c7e0c1e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

art/attacks/newtonfool.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ def generate(self, x, **kwargs):
4242
x_adv = x.copy()
4343

4444
# Initialize variables
45+
clip_min, clip_max = self.classifier.clip_values
4546
y_pred = self.classifier.predict(x, logits=False)
4647
pred_class = np.argmax(y_pred, axis=1)
4748

@@ -68,6 +69,9 @@ def generate(self, x, **kwargs):
6869
# Update xi and pertubation
6970
ex += di
7071

72+
# Apply clip
73+
x_adv[j] = np.clip(ex, clip_min, clip_max)
74+
7175
return x_adv
7276

7377
def set_params(self, **kwargs):

0 commit comments

Comments
 (0)