Skip to content

Commit eadb0f9

Browse files
committed
add examples to pytorch basics
1 parent f1d21a6 commit eadb0f9

File tree

1 file changed

+3
-3
lines changed
  • tutorials/00 - PyTorch Basics

1 file changed

+3
-3
lines changed

tutorials/00 - PyTorch Basics/main.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@
2727
# Build a computational graph.
2828
y = w * x + b # y = 2 * x + 3
2929

30-
# Compute gradients
30+
# Compute gradients.
3131
y.backward()
3232

33-
# Print out the gradients
33+
# Print out the gradients.
3434
print(x.grad) # x.grad = 2
3535
print(w.grad) # w.grad = 1
3636
print(b.grad) # b.grad = 1
@@ -146,7 +146,7 @@ def __len__(self):
146146
# Replace top layer for finetuning.
147147
resnet.fc = nn.Linear(resnet.fc.in_features, 100) # 100 is for example.
148148

149-
# For test
149+
# For test.
150150
images = Variable(torch.randn(10, 3, 256, 256))
151151
outputs = resnet(images)
152152
print (outputs.size()) # (10, 100)

0 commit comments

Comments
 (0)