05425c36bd27b0611f0ea202aaf9d3c3934bda59,cleverhans/attacks.py,MomentumIterativeMethod,generate,#MomentumIterativeMethod#Any#,482

Before Change


            if self.ord == np.inf:
                normalized_grad = tf.sign(momentum)
            elif self.ord in [1, 2]:
                reduc_ind = list(xrange(1, len(momentum.get_shape())))
                if self.ord == 1:
                    norm = tf.reduce_sum(tf.abs(momentum),
                                         reduction_indices=reduc_ind,
                                         keep_dims=True)

After Change


                square = tf.reduce_sum(tf.square(momentum),
                                       red_ind,
                                       keep_dims=True)
                norm = tf.sqrt(tf.maximum(avoid_zero_div, square))
                normalized_grad = momentum / norm
            else:
                raise NotImplementedError("Only L-inf, L1 and L2 norms are "
                                          "currently implemented.")
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: tensorflow/cleverhans
Commit Name: 05425c36bd27b0611f0ea202aaf9d3c3934bda59
Time: 2017-12-23
Author: dongyinpeng@gmail.com
File Name: cleverhans/attacks.py
Class Name: MomentumIterativeMethod
Method Name: generate


Project Name: SeanNaren/deepspeech.pytorch
Commit Name: e30b50ff849a417b8e70d121edd2e85f0565eee1
Time: 2017-09-13
Author: jinserk.baik@gmail.com
File Name: data/data_loader.py
Class Name: NoiseInjection
Method Name: inject_noise_sample


Project Name: geekcomputers/Python
Commit Name: 139259ac8ac83160502cbb896371ce4fa4027361
Time: 2019-10-10
Author: ml.smiley3@gmail.com
File Name: primelib/primelib.py
Class Name:
Method Name: sieveEr