Merge pull request #188 from qy-yang/fix#187

fix #187 Typos in language model and generative_adversarial_network
This commit is contained in:
Yunjey Choi
2020-01-28 00:11:10 +09:00
committed by GitHub
2 changed files with 7 additions and 3 deletions

View File

@ -76,7 +76,7 @@ for epoch in range(num_epochs):
loss = criterion(outputs, targets.reshape(-1))
# Backward and optimize
model.zero_grad()
optimizer.zero_grad()
loss.backward()
clip_grad_norm_(model.parameters(), 0.5)
optimizer.step()

View File

@ -22,10 +22,14 @@ if not os.path.exists(sample_dir):
os.makedirs(sample_dir)
# Image processing
# transform = transforms.Compose([
# transforms.ToTensor(),
# transforms.Normalize(mean=(0.5, 0.5, 0.5), # 3 for RGB channels
# std=(0.5, 0.5, 0.5))])
transform = transforms.Compose([
transforms.ToTensor(),
transforms.Normalize(mean=(0.5, 0.5, 0.5), # 3 for RGB channels
std=(0.5, 0.5, 0.5))])
transforms.Normalize(mean=[0.5], # 1 for greyscale channels
std=[0.5])])
# MNIST dataset
mnist = torchvision.datasets.MNIST(root='../../data/',