File tree Expand file tree Collapse file tree 1 file changed +2
-0
lines changed Expand file tree Collapse file tree 1 file changed +2
-0
lines changed Original file line number Diff line number Diff line change @@ -108,6 +108,7 @@ def repackage_hidden(h):
108108 else :
109109 return tuple (repackage_hidden (v ) for v in h )
110110
111+
111112# get_batch subdivides the source data into chunks of length args.bptt.
112113# If source is equal to the example output of the batchify function, with
113114# a bptt-limit of 2, we'd get the following two Variables for i = 0:
@@ -117,6 +118,7 @@ def repackage_hidden(h):
117118# done along the batch dimension (i.e. dimension 1), since that was handled
118119# by the batchify function. The chunks are along dimension 0, corresponding
119120# to the seq_len dimension in the LSTM.
121+
120122def get_batch (source , i , evaluation = False ):
121123 seq_len = min (args .bptt , len (source ) - 1 - i )
122124 data = Variable (source [i :i + seq_len ], volatile = evaluation )
You can’t perform that action at this time.
0 commit comments