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 51a001c commit 034b45dCopy full SHA for 034b45d
art/attacks/deepfool.py
@@ -81,7 +81,7 @@ def generate(self, x, **kwargs):
81
value = np.ma.array(np.abs(f_diff) / norm, mask=mask)
82
83
l = value.argmin(fill_value=np.inf)
84
- r = (abs(f_diff[l]) / pow(np.linalg.norm(grad_diff[l]), 2)) * grad_diff[l]
+ r = (abs(f_diff[l]) / (pow(np.linalg.norm(grad_diff[l]), 2) + tol)) * grad_diff[l]
85
86
# Add perturbation and clip result
87
xj = np.clip(xj + r, clip_min, clip_max)
0 commit comments