953111b5e72effeed6ed1ae1294ab0703d828e89,cleverhans/attacks.py,SaliencyMapMethod,generate_numpy,#SaliencyMapMethod#Any#Any#Any#Any#Any#,262

Before Change


            raise Exception("SaliencyMapMethod currently only handles one sample"
                            "at a time. Make sure that len(X) = 1.")
        if target is None:
            raise Exception("For now, user must provide target classes.")
            // // No targets provided, so we will randomly choose targets from the incorrect classes
            // if Y is None:
            //     // No true labels provided: use model predictions as ground truth
            //     if self.backend == "tf":

After Change


        if target is None:
            // No targets provided, so we will randomly choose targets from the
            // incorrect classes
            if Y is None:
                // No true labels provided: use model predictions as ground truth
                if self.backend == "tf":
                    from .utils_tf import model_argmax
                else:
                    from .utils_th import model_argmax
                gt = model_argmax(self.x, self.pred, X)
            else:
                // True labels were provided
                gt = np.argmax(Y, axis=1)
            // Randomly choose from the incorrect classes for each sample
            // TODO: remove [0] once we fix SaliencyMapMethod to handle multiple samples
            target = random_targets(gt, self.nb_classes)[0]
        else:
            if Y is not None:
                warnings.warn("Ignoring "Y" argument since class targets were provided.")
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: tensorflow/cleverhans
Commit Name: 953111b5e72effeed6ed1ae1294ab0703d828e89
Time: 2017-03-24
Author: rfeinman16@gmail.com
File Name: cleverhans/attacks.py
Class Name: SaliencyMapMethod
Method Name: generate_numpy


Project Name: IBM/adversarial-robustness-toolbox
Commit Name: 57d46b39765a5fe33a7f8d964387bb479619005b
Time: 2020-03-04
Author: beat.buesser@ie.ibm.com
File Name: art/classifiers/tensorflow.py
Class Name: TensorFlowV2Classifier
Method Name: fit_generator


Project Name: tensorflow/models
Commit Name: dfe2a43fb378b557f3dfc4315417afb291cd16b7
Time: 2018-09-25
Author: aman2930@gmail.com
File Name: official/mnist/mnist_tpu.py
Class Name:
Method Name: model_fn