Skip to content

Commit

Permalink
source /home/hwnam/anaconda3/bin/activateMerge branch 'desktop' of ht…
Browse files Browse the repository at this point in the history
…tps://github.com/hwnam831/ring-defender into desktop

conda activate base
  • Loading branch information
hwnam831 committed Dec 16, 2020
2 parents 61195cc + d6a498d commit 620a5f3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Models.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ def forward(self, x):
out = out + res #N,S,C
out = self.decoder(out).view(out.size(0),-1)
#out = out + self.scale*torch.randn_like(out)
out = out + noise
#out = out + noise

return torch.relu(out)

Expand Down
5 changes: 3 additions & 2 deletions RingClassifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from torch.utils.data import random_split
import torch.nn as nn
import re

import time



Expand Down Expand Up @@ -171,6 +171,7 @@ def quantizer(arr, std=8):
for e in range(args.epochs):
gen.train()
classifier.train()
trainstart = time.time()
for x,y in trainloader:
xdata, ydata = x.cuda(), y.cuda()
shifted = shifter(xdata)
Expand Down Expand Up @@ -244,7 +245,7 @@ def quantizer(arr, std=8):
totcorrect += (pred==ydata).sum().item()
totcount += y.size(0)
macc = float(totcorrect)/totcount
print("epoch {} \t acc {:.6f}\t loss {:.6f}\t Avg perturb {:.6f}\n".format(e+1, macc, mloss, mnorm))
print("epoch {} \t acc {:.4f}\t loss {:.4f}\t Avg perturb {:.4f}\t duration {:.4f}\n".format(e+1, macc, mloss, mnorm, time.time()-trainstart))
if e > (args.epochs*4)//5 and macc - 0.5 < 0.001:
break
gen.eval()
Expand Down

0 comments on commit 620a5f3

Please sign in to comment.