We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f1d21a6 commit eadb0f9Copy full SHA for eadb0f9
tutorials/00 - PyTorch Basics/main.py
@@ -27,10 +27,10 @@
27
# Build a computational graph.
28
y = w * x + b # y = 2 * x + 3
29
30
-# Compute gradients
+# Compute gradients.
31
y.backward()
32
33
-# Print out the gradients
+# Print out the gradients.
34
print(x.grad) # x.grad = 2
35
print(w.grad) # w.grad = 1
36
print(b.grad) # b.grad = 1
@@ -146,7 +146,7 @@ def __len__(self):
146
# Replace top layer for finetuning.
147
resnet.fc = nn.Linear(resnet.fc.in_features, 100) # 100 is for example.
148
149
-# For test
+# For test.
150
images = Variable(torch.randn(10, 3, 256, 256))
151
outputs = resnet(images)
152
print (outputs.size()) # (10, 100)
0 commit comments