Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
MorvanZhou authored and Morvan Zhou committed May 23, 2017
1 parent 30c0070 commit d87529e
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 10 deletions.
1 change: 0 additions & 1 deletion tutorial-contents/301_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ def forward(self, x):
loss_func = torch.nn.MSELoss() # this is for regression mean squared loss

plt.ion() # something about plotting
plt.show()

for t in range(100):
prediction = net(x) # input x and predict based on x
Expand Down
1 change: 0 additions & 1 deletion tutorial-contents/302_classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ def forward(self, x):
loss_func = torch.nn.CrossEntropyLoss() # the target label is NOT an one-hotted

plt.ion() # something about plotting
plt.show()

for t in range(100):
out = net(x) # input x and predict based on x
Expand Down
16 changes: 15 additions & 1 deletion tutorial-contents/303_build_nn_quickly.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,18 @@ def forward(self, x):


print(net1) # net1 architecture
print(net2) # net2 architecture
"""
Net (
(hidden): Linear (1 -> 10)
(predict): Linear (10 -> 1)
)
"""

print(net2) # net2 architecture
"""
Sequential (
(0): Linear (1 -> 10)
(1): ReLU ()
(2): Linear (10 -> 1)
)
"""
1 change: 0 additions & 1 deletion tutorial-contents/403_RNN_regressor.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ def forward(self, x, h_state):

plt.figure(1, figsize=(12, 5))
plt.ion() # continuously plot
plt.show()

for step in range(60):
start, end = step * np.pi, (step+1)*np.pi # time range
Expand Down
1 change: 0 additions & 1 deletion tutorial-contents/404_autoencoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ def forward(self, x):
# initialize figure
f, a = plt.subplots(2, N_TEST_IMG, figsize=(5, 2))
plt.ion() # continuously plot
plt.show()

# original data (first row) for viewing
view_data = Variable(train_data.train_data[:N_TEST_IMG].view(-1, 28*28).type(torch.FloatTensor)/255.)
Expand Down
2 changes: 1 addition & 1 deletion tutorial-contents/406_GAN.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def artist_works(): # painting from the famous artist (real target)
opt_G = torch.optim.Adam(G.parameters(), lr=LR_G)

plt.ion() # something about continuous plotting
plt.show()

for step in range(10000):
artist_paintings = artist_works() # real painting from artist
G_ideas = Variable(torch.randn(BATCH_SIZE, N_IDEAS)) # random ideas
Expand Down
2 changes: 1 addition & 1 deletion tutorial-contents/406_conditional_GAN.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def artist_works_with_labels(): # painting from the famous artist (real targ
opt_G = torch.optim.Adam(G.parameters(), lr=LR_G)

plt.ion() # something about continuous plotting
plt.show()

for step in range(10000):
artist_paintings, labels = artist_works_with_labels() # real painting, label from artist
G_ideas = Variable(torch.randn(BATCH_SIZE, N_IDEAS)) # random ideas
Expand Down
1 change: 0 additions & 1 deletion tutorial-contents/501_why_torch_dynamic_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ def forward(self, x, h_state):

plt.figure(1, figsize=(12, 5))
plt.ion() # continuously plot
plt.show()

######################## Below is different #########################

Expand Down
1 change: 0 additions & 1 deletion tutorial-contents/503_dropout.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
loss_func = torch.nn.MSELoss()

plt.ion() # something about plotting
plt.show()

for t in range(500):
pred_ofit = net_overfitting(x)
Expand Down
1 change: 0 additions & 1 deletion tutorial-contents/504_batch_normalization.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
# show data
plt.scatter(train_x.numpy(), train_y.numpy(), c='#FF9359', s=50, alpha=0.2, label='train')
plt.legend(loc='upper left')
plt.show()

class Net(nn.Module):
def __init__(self, batch_normalization=False):
Expand Down

0 comments on commit d87529e

Please sign in to comment.