Skip to content

Commit

Permalink
Consistent newlines
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikolai Morin authored and soumith committed Oct 26, 2017
1 parent 7532a61 commit fad7759
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions word_language_model/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ def repackage_hidden(h):
else:
return tuple(repackage_hidden(v) for v in h)


# get_batch subdivides the source data into chunks of length args.bptt.
# If source is equal to the example output of the batchify function, with
# a bptt-limit of 2, we'd get the following two Variables for i = 0:
Expand All @@ -117,6 +118,7 @@ def repackage_hidden(h):
# done along the batch dimension (i.e. dimension 1), since that was handled
# by the batchify function. The chunks are along dimension 0, corresponding
# to the seq_len dimension in the LSTM.

def get_batch(source, i, evaluation=False):
seq_len = min(args.bptt, len(source) - 1 - i)
data = Variable(source[i:i+seq_len], volatile=evaluation)
Expand Down

0 comments on commit fad7759

Please sign in to comment.