We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f2fb60f commit 40c96d8Copy full SHA for 40c96d8
src/attacks/fast_gradient.py
@@ -211,7 +211,8 @@ def set_params(self, **kwargs):
211
if self.ord not in [np.inf, int(1), int(2)]:
212
raise ValueError("Norm order must be either np.inf, 1, or 2.")
213
214
- if self.eps <= self.clip_min or self.eps > self.clip_max:
215
- raise ValueError('The amount of perturbation has to be in the data range.')
+ if self.clip_min is not None and self.clip_max is not None:
+ if self.eps <= self.clip_min or self.eps > self.clip_max:
216
+ raise ValueError('The amount of perturbation has to be in the data range.')
217
218
return True
0 commit comments