Skip to content

Commit 6aa8b5e

Browse files
committed
Merge branch 'master' of github.com:pytorch/tutorials into rl_cuda
2 parents 9770577 + 17b8b4d commit 6aa8b5e

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

beginner_source/blitz/autograd_tutorial.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@
3636
3737
``Variable`` and ``Function`` are interconnected and build up an acyclic
3838
graph, that encodes a complete history of computation. Each variable has
39-
a ``.creator`` attribute that references a ``Function`` that has created
39+
a ``.grad_fn`` attribute that references a ``Function`` that has created
4040
the ``Variable`` (except for Variables created by the user - their
41-
``creator is None``).
41+
``grad_fn is None``).
4242
4343
If you want to compute the derivatives, you can call ``.backward()`` on
4444
a ``Variable``. If ``Variable`` is a scalar (i.e. it holds a one element
@@ -61,8 +61,8 @@
6161
print(y)
6262

6363
###############################################################
64-
# ``y`` was created as a result of an operation, so it has a creator.
65-
print(y.creator)
64+
# ``y`` was created as a result of an operation, so it has a ``grad_fn``.
65+
print(y.grad_fn)
6666

6767
###############################################################
6868
# Do more operations on y

beginner_source/blitz/neural_networks_tutorial.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,15 +157,15 @@ def num_flat_features(self, x):
157157
# For example:
158158

159159
output = net(input)
160-
target = Variable(torch.range(1, 10)) # a dummy target, for example
160+
target = Variable(torch.arange(1, 11)) # a dummy target, for example
161161
criterion = nn.MSELoss()
162162

163163
loss = criterion(output, target)
164164
print(loss)
165165

166166
########################################################################
167167
# Now, if you follow ``loss`` in the backward direction, using it’s
168-
# ``.creator`` attribute, you will see a graph of computations that looks
168+
# ``.grad_fn`` attribute, you will see a graph of computations that looks
169169
# like this:
170170
#
171171
# ::
@@ -181,9 +181,9 @@ def num_flat_features(self, x):
181181
#
182182
# For illustration, let us follow a few steps backward:
183183

184-
print(loss.creator) # MSELoss
185-
print(loss.creator.previous_functions[0][0]) # Linear
186-
print(loss.creator.previous_functions[0][0].previous_functions[0][0]) # ReLU
184+
print(loss.grad_fn) # MSELoss
185+
print(loss.grad_fn.next_functions[0][0]) # Linear
186+
print(loss.grad_fn.next_functions[0][0].next_functions[0][0]) # ReLU
187187

188188
########################################################################
189189
# Backprop

beginner_source/nlp/advanced_tutorial.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Advanced: Making Dynamic Decisions and the Bi-LSTM CRF
44
======================================================
55
6-
Dyanmic versus Static Deep Learning Toolkits
6+
Dynamic versus Static Deep Learning Toolkits
77
--------------------------------------------
88
99
Pytorch is a *dynamic* neural network kit. Another example of a dynamic

beginner_source/nlp/word_embeddings_tutorial.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ def forward(self, inputs):
290290
# and :math:`w_{i+1}, \dots, w_{i+N}`, referring to all context words
291291
# collectively as :math:`C`, CBOW tries to minimize
292292
#
293-
# .. math:: -\log p(w_i | C) = \log \text{Softmax}(A(\sum_{w \in C} q_w) + b)
293+
# .. math:: -\log p(w_i | C) = -\log \text{Softmax}(A(\sum_{w \in C} q_w) + b)
294294
#
295295
# where :math:`q_w` is the embedding for word :math:`w`.
296296
#

0 commit comments

Comments
 (0)