Skip to content

Commit 1c16b6c

Browse files
iamazizapaszke
authored andcommitted
remove unused lines (pytorch#84)
* remove unused import statements * remove unused variable and arguments
1 parent b840cad commit 1c16b6c

File tree

7 files changed

+3
-12
lines changed

7 files changed

+3
-12
lines changed

mnist_hogwild/main.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from __future__ import print_function
2-
import os, argparse
2+
import argparse
33
import torch
44
import torch.nn as nn
55
import torch.nn.functional as F

mnist_hogwild/train.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,12 @@ def train(rank, args, model):
2828
optimizer = optim.SGD(model.parameters(), lr=args.lr, momentum=args.momentum)
2929
for epoch in range(1, args.epochs + 1):
3030
train_epoch(epoch, args, model, train_loader, optimizer)
31-
test_epoch(epoch, args, model, test_loader)
31+
test_epoch(model, test_loader)
3232

3333

3434
def train_epoch(epoch, args, model, data_loader, optimizer):
3535
model.train()
3636
pid = os.getpid()
37-
samples_seen = 0
3837
for batch_idx, (data, target) in enumerate(data_loader):
3938
data, target = Variable(data), Variable(target)
4039
optimizer.zero_grad()
@@ -48,7 +47,7 @@ def train_epoch(epoch, args, model, data_loader, optimizer):
4847
100. * batch_idx / len(data_loader), loss.data[0]))
4948

5049

51-
def test_epoch(epoch, args, model, data_loader):
50+
def test_epoch(model, data_loader):
5251
model.eval()
5352
test_loss = 0
5453
correct = 0

reinforcement_learning/actor_critic.py

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import torch.optim as optim
1111
import torch.autograd as autograd
1212
from torch.autograd import Variable
13-
import torchvision.transforms as T
1413

1514

1615
parser = argparse.ArgumentParser(description='PyTorch actor-critic example')

reinforcement_learning/reinforce.py

-2
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,13 @@
22
import gym
33
import numpy as np
44
from itertools import count
5-
from collections import namedtuple
65

76
import torch
87
import torch.nn as nn
98
import torch.nn.functional as F
109
import torch.optim as optim
1110
import torch.autograd as autograd
1211
from torch.autograd import Variable
13-
import torchvision.transforms as T
1412

1513

1614
parser = argparse.ArgumentParser(description='PyTorch REINFORCE example')

super_resolution/dataset.py

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
from os import listdir
44
from os.path import join
5-
import numpy as np
65
from PIL import Image
76

87

word_language_model/generate.py

-3
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,8 @@
66
###############################################################################
77

88
import argparse
9-
import time
10-
import math
119

1210
import torch
13-
import torch.nn as nn
1411
from torch.autograd import Variable
1512

1613
import data

word_language_model/model.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import torch
21
import torch.nn as nn
32
from torch.autograd import Variable
43

0 commit comments

Comments
 (0)