From eadb0f9580bffc47a0a40073301766f97a9883ab Mon Sep 17 00:00:00 2001 From: yunjey Date: Sun, 12 Mar 2017 14:06:00 +0900 Subject: [PATCH] add examples to pytorch basics --- tutorials/00 - PyTorch Basics/main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tutorials/00 - PyTorch Basics/main.py b/tutorials/00 - PyTorch Basics/main.py index 7873e00..3f0186a 100644 --- a/tutorials/00 - PyTorch Basics/main.py +++ b/tutorials/00 - PyTorch Basics/main.py @@ -27,10 +27,10 @@ b = Variable(torch.Tensor([3]), requires_grad=True) # Build a computational graph. y = w * x + b # y = 2 * x + 3 -# Compute gradients +# Compute gradients. y.backward() -# Print out the gradients +# Print out the gradients. print(x.grad) # x.grad = 2 print(w.grad) # w.grad = 1 print(b.grad) # b.grad = 1 @@ -146,7 +146,7 @@ for param in resnet.parameters(): # Replace top layer for finetuning. resnet.fc = nn.Linear(resnet.fc.in_features, 100) # 100 is for example. -# For test +# For test. images = Variable(torch.randn(10, 3, 256, 256)) outputs = resnet(images) print (outputs.size()) # (10, 100)