This commit is contained in:
Nataniel Ruiz
2019-12-26 10:10:26 -04:00
parent 4161e50d0e
commit 534c3702c8
+5 -5
View File
@@ -609,18 +609,18 @@ class Solver(object):
# Translate images.
x_fake_list = [x_real]
x_advs = {}
x_advs = []
if i == 0:
for c_trg in c_trg_list:
for idx, c_trg in enumerate(c_trg_list):
x_adv, perturb = pgd_attack.perturb(x_real, black, c_trg)
x_advs[c_trg] = x_adv, perturb
x_advs.append(x_adv, perturb)
for c_trg in c_trg_list:
for idx, c_trg in enumerate(c_trg_list):
with torch.no_grad():
gen_noattack, gen_noattack_feats = self.G(x_real, c_trg)
# Attack
# x_adv, perturb = pgd_attack.perturb(x_real, black, c_trg)
_, perturb = x_advs[c_trg]
_, perturb = x_advs[idx]
x_adv = x_real + perturb
# x_adv = self.blur_tensor(x_adv)