23d00b78af8b6fc554a033c30dc4b0f8ffaf4804,art/attacks/deepfool.py,DeepFool,generate,#DeepFool#Any#,34

Before Change


            fk_i_hat = fk_hat
            nb_iter = 0

            while fk_i_hat == fk_hat and nb_iter < self.max_iter:
                grad_diff = grd - grd[fk_hat]
                f_diff = f - f[fk_hat]

                // Masking true label
                mask = [0] * self.classifier.nb_classes
                mask[fk_hat] = 1
                norm = np.linalg.norm(grad_diff.reshape(self.classifier.nb_classes, -1), axis=1) + tol
                value = np.ma.array(np.abs(f_diff) / norm, mask=mask)

                l = value.argmin(fill_value=np.inf)
                r = (abs(f_diff[l]) / (pow(np.linalg.norm(grad_diff[l]), 2) + tol)) * grad_diff[l]

                // Add perturbation and clip result
                xj = np.clip(xj + r, clip_min, clip_max)

After Change



        for j, val in enumerate(x_adv):
            xj = val[None, ...]
            f = preds[j]
            grd = self.classifier.class_gradient(xj, logits=True)[0]
            fk_hat = np.argmax(f)

            for _ in range(self.max_iter):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: IBM/adversarial-robustness-toolbox
Commit Name: 23d00b78af8b6fc554a033c30dc4b0f8ffaf4804
Time: 2018-10-26
Author: Maria-Irina.Nicolae@ibm.com
File Name: art/attacks/deepfool.py
Class Name: DeepFool
Method Name: generate


Project Name: Epistimio/orion
Commit Name: 9d941d30962c211971ec316bf40c2ebfbf28a567
Time: 2021-02-24
Author: xavier.bouthillier@umontreal.ca
File Name: src/orion/analysis/lpi_utils.py
Class Name:
Method Name: lpi


Project Name: scikit-video/scikit-video
Commit Name: c8102caf93b5ef5faa7effbdd581d83c632c0b83
Time: 2016-12-05
Author: tgoodall@utexas.edu
File Name: skvideo/motion/block.py
Class Name:
Method Name: _minCost