e6a1a4bb326d673a029ca05f90d9e3930a89333b,cleverhans/attacks.py,CarliniWagnerL2,generate,#CarliniWagnerL2#Any#,618

Before Change


                      self.initial_const, self.clip_min, self.clip_max,
                      self.nb_classes, x.get_shape().as_list()[1:])

        if "y" in kwargs and "y_target" in kwargs:
            raise ValueError("Can not set both "y" and "y_target".")
        elif "y" in kwargs:
            labels = kwargs["y"]
        elif "y_target" in kwargs:
            labels = kwargs["y_target"]
        else:
            preds = self.model.get_probs(x)
            preds_max = tf.reduce_max(preds, 1, keep_dims=True)
            original_predictions = tf.to_float(tf.equal(preds,
                                                        preds_max))
            labels = original_predictions

        def cw_wrap(x_val, y_val):
            return np.array(attack.attack(x_val, y_val), dtype=np.float32)
        wrap = tf.py_func(cw_wrap, [x, labels], tf.float32)

After Change


        from .attacks_tf import CarliniWagnerL2 as CWL2
        self.parse_params(**kwargs)

        labels, nb_classes = self.get_labels(x, kwargs)

        attack = CWL2(self.sess, self.model, self.batch_size,
                      self.confidence, "y_target" in kwargs,
                      self.learning_rate, self.binary_search_steps,
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: tensorflow/cleverhans
Commit Name: e6a1a4bb326d673a029ca05f90d9e3930a89333b
Time: 2017-08-14
Author: nicholas@carlini.com
File Name: cleverhans/attacks.py
Class Name: CarliniWagnerL2
Method Name: generate


Project Name: ysig/GraKeL
Commit Name: a9a52c80bb69cd3195a023db375488c4aee590de
Time: 2017-12-04
Author: y.siglidis@gmail.com
File Name: grakel/graph.py
Class Name: graph
Method Name: label


Project Name: tensorflow/cleverhans
Commit Name: 5d9538304b5f003be34d49693067cfc3afc18ff0
Time: 2017-08-14
Author: nicholas@carlini.com
File Name: cleverhans/attacks.py
Class Name: FastGradientMethod
Method Name: generate