Skip to content

Commit 3c45908

Browse files
authored
Merge branch 'master' into add-youtube-tutorials
2 parents 4d54a4b + cecea51 commit 3c45908

File tree

8 files changed

+18
-20
lines changed

8 files changed

+18
-20
lines changed

beginner_source/README.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ Beginner Tutorials
2323

2424
6. transformer_translation.py
2525
Language Translation with Transformers
26-
https://pytorch.org/tutorials/beginner/transformer_translation.html
26+
https://pytorch.org/tutorials/beginner/transformer_tutorial.html

beginner_source/blitz/autograd_tutorial.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,14 +170,12 @@
170170
# vector-Jacobian product. That is, given any vector :math:`\vec{v}`, compute the product
171171
# :math:`J^{T}\cdot \vec{v}`
172172
#
173-
# If :math:`v` happens to be the gradient of a scalar function
173+
# If :math:`\vec{v}` happens to be the gradient of a scalar function :math:`l=g\left(\vec{y}\right)`:
174174
#
175175
# .. math::
176176
#
177177
#
178-
# l
179-
# =
180-
# g\left(\vec{y}\right)
178+
# \vec{v}
181179
# =
182180
# \left(\begin{array}{ccc}\frac{\partial l}{\partial y_{1}} & \cdots & \frac{\partial l}{\partial y_{m}}\end{array}\right)^{T}
183181
#

beginner_source/blitz/cifar10_tutorial.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@
6262
########################################################################
6363
# The output of torchvision datasets are PILImage images of range [0, 1].
6464
# We transform them to Tensors of normalized range [-1, 1].
65+
66+
########################################################################
6567
# .. note::
6668
# If running on Windows and you get a BrokenPipeError, try setting
6769
# the num_worker of torch.utils.data.DataLoader() to 0.
@@ -70,14 +72,16 @@
7072
[transforms.ToTensor(),
7173
transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))])
7274

75+
batch_size = 4
76+
7377
trainset = torchvision.datasets.CIFAR10(root='./data', train=True,
7478
download=True, transform=transform)
75-
trainloader = torch.utils.data.DataLoader(trainset, batch_size=4,
79+
trainloader = torch.utils.data.DataLoader(trainset, batch_size=batch_size,
7680
shuffle=True, num_workers=2)
7781

7882
testset = torchvision.datasets.CIFAR10(root='./data', train=False,
7983
download=True, transform=transform)
80-
testloader = torch.utils.data.DataLoader(testset, batch_size=4,
84+
testloader = torch.utils.data.DataLoader(testset, batch_size=batch_size,
8185
shuffle=False, num_workers=2)
8286

8387
classes = ('plane', 'car', 'bird', 'cat',
@@ -106,7 +110,7 @@ def imshow(img):
106110
# show images
107111
imshow(torchvision.utils.make_grid(images))
108112
# print labels
109-
print(' '.join('%5s' % classes[labels[j]] for j in range(4)))
113+
print(' '.join('%5s' % classes[labels[j]] for j in range(batch_size)))
110114

111115

112116
########################################################################

beginner_source/examples_nn/polynomial_module.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ def string(self):
4949
model = Polynomial3()
5050

5151
# Construct our loss function and an Optimizer. The call to model.parameters()
52-
# in the SGD constructor will contain the learnable parameters of the nn.Linear
53-
# module which is members of the model.
52+
# in the SGD constructor will contain the learnable parameters (defined
53+
# with torch.nn.Parameter) which are members of the model.
5454
criterion = torch.nn.MSELoss(reduction='sum')
5555
optimizer = torch.optim.SGD(model.parameters(), lr=1e-6)
5656
for t in range(2000):

beginner_source/nlp/pytorch_tutorial.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@
1414
# Author: Robert Guthrie
1515

1616
import torch
17-
import torch.autograd as autograd
18-
import torch.nn as nn
19-
import torch.nn.functional as F
20-
import torch.optim as optim
2117

2218
torch.manual_seed(1)
2319

intermediate_source/README.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ Intermediate tutorials
3131

3232
8. flask_rest_api_tutorial.py
3333
Deploying PyTorch and Building a REST API using Flask
34-
https://pytorch.org/tutorials/beginner/flask_rest_api_tutorial.html
34+
https://pytorch.org/tutorials/intermediate/flask_rest_api_tutorial.html

intermediate_source/fx_conv_bn_fuser.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def __init__(self):
5151
nn.BatchNorm2d(1),
5252
nn.Conv2d(1, 1, 1),
5353
)
54-
self.wrapped = WrappedBatchnorm()
54+
self.wrapped = WrappedBatchNorm()
5555

5656
def forward(self, x):
5757
x = self.conv1(x)
@@ -259,4 +259,4 @@ def benchmark(model, iters=20):
259259
# feedback you have about using it. Please feel free to use the
260260
# PyTorch Forums (https://discuss.pytorch.org/) and the issue tracker
261261
# (https://github.com/pytorch/pytorch/issues) to provide any feedback
262-
# you might have.
262+
# you might have.

intermediate_source/torchvision_tutorial.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ should return:
5454

5555
If your model returns the above methods, they will make it work for both
5656
training and evaluation, and will use the evaluation scripts from
57-
``pycocotools``.
57+
``pycocotools`` which can be installed with ``pip install pycocotools``.
5858

5959
.. note ::
6060
For Windows, please install ``pycocotools`` from `gautamchitnis <https://github.com/gautamchitnis/cocoapi>`__ with command
@@ -317,8 +317,8 @@ Putting everything together
317317
In ``references/detection/``, we have a number of helper functions to
318318
simplify training and evaluating detection models. Here, we will use
319319
``references/detection/engine.py``, ``references/detection/utils.py``
320-
and ``references/detection/transforms.py``. Just copy them to your
321-
folder and use them here.
320+
and ``references/detection/transforms.py``. Just copy everything under
321+
``references/detection`` to your folder and use them here.
322322

323323
Let’s write some helper functions for data augmentation /
324324
transformation:

0 commit comments

Comments
 (0)