Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions intermediate_source/char_rnn_generation_tutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,15 @@ def timeSince(since):
# - Return the final name
#
# .. note::
# ``rnn`` is still in training mode here, so the dropout layer stays
# active while sampling. ``torch.no_grad()`` only turns off gradient
# tracking; it does not turn off dropout. This is what makes the samples
# vary from run to run even though we always pick the top letter. To get
# the same name every time for a given category and starting letter,
# call ``rnn.eval()`` before sampling (and ``rnn.train()`` before training
# again).
#
# .. note::
# Rather than having to give it a starting letter, another
# strategy would have been to include a "start of string" token in
# training and have the network choose its own starting letter.
Expand Down