This commit is contained in:
Nataniel Ruiz
2019-12-23 16:49:26 -04:00
parent 1b162241ed
commit 0f5f9abbd2
3 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -29,7 +29,7 @@ class LinfPGDAttack(object):
output, feats = self.model(X, c_trg)
if self.feat:
print('self.feat ', self.feat)
# print('self.feat ', self.feat)
output = feats[self.feat]
y = np.zeros(output.shape)
y = torch.FloatTensor(y).to(self.device)
+2 -2
View File
@@ -66,10 +66,10 @@ class Generator(nn.Module):
# Get intermediate feature maps
for layer in self.main:
print('test')
# print('test')
x = layer(x)
feature_maps.append(x)
print(len(feature_maps))
# print(len(feature_maps))
return x, feature_maps
+2 -2
View File
@@ -587,7 +587,7 @@ class Solver(object):
n_samples = 0
# 11 layers
layer_num = 0
layer_num_orig = 0
for i, (x_real, c_org) in enumerate(data_loader):
# Black image
@@ -598,7 +598,7 @@ class Solver(object):
x_real = x_real.to(self.device)
c_trg_list = self.create_labels(c_org, self.c_dim, self.dataset, self.selected_attrs)
layer_num = (layer_num + 1) * 3 - 1
layer_num = (layer_num_orig + 1) * 3 - 1
pgd_attack = attacks.LinfPGDAttack(model=self.G, device=self.device, feat=layer_num)
# Translate images.