next
This commit is contained in:
+1
-1
@@ -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
@@ -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
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user