48a54c32a55896620b0523d5a3a68b1826f957cc,art/attacks/virtual_adversarial.py,VirtualAdversarialMethod,generate,#VirtualAdversarialMethod#Any#,38
Before Change
kl_div1 = entropy(np.transpose(preds[batch_index_1:batch_index_2]), np.transpose(preds_new))
d_new = np.zeros_like(d)
array_iter = np.nditer(d, op_flags=["readwrite"], flags=["multi_index"])
for x in array_iter:
x[...] += self.finite_diff
preds_new = self.classifier.predict((val + d)[None, ...], logits=False)
kl_div2 = entropy(preds[ind], preds_new[0])
After Change
kl_div1 = entropy(np.transpose(preds[batch_index_1:batch_index_2]), np.transpose(preds_new))
d_new = np.zeros_like(d)
for w in range(d.shape[1]):
for h in range(d.shape[2]):
for c in range(d.shape[3]):
d[:, w, h, c] += self.finite_diff
preds_new = self.classifier.predict(batch + d, logits=False)
kl_div2 = entropy(np.transpose(preds[batch_index_1:batch_index_2]), np.transpose(preds_new))
d_new[:, w, h, c] = (kl_div2 - kl_div1) / (self.finite_diff + tol)
d[:, w, h, c] -= self.finite_diff
d = d_new
// Apply perturbation and clip
x_adv[batch_index_1:batch_index_2] = np.clip(batch + self.eps * self._normalize(d), clip_min, clip_max)
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 3
Instances
Project Name: IBM/adversarial-robustness-toolbox
Commit Name: 48a54c32a55896620b0523d5a3a68b1826f957cc
Time: 2019-01-14
Author: M.N.Tran@ibm.com
File Name: art/attacks/virtual_adversarial.py
Class Name: VirtualAdversarialMethod
Method Name: generate
Project Name: scipy/scipy
Commit Name: 45f27df49ba3d0f90fc16d7320986447492cf6e2
Time: 2020-07-07
Author: peterbell10@live.co.uk
File Name: scipy/spatial/kdtree.py
Class Name: KDTree
Method Name: query
Project Name: data61/python-paillier
Commit Name: 96416b889c76f3b6d15af0e3dfd0d4cb2b8b2d23
Time: 2017-06-15
Author: giorgio.patrini@anu.edu.au
File Name: examples/paillier_logistic_regression.py
Class Name: Alice
Method Name: encrypt_weights