MCPcopy Create free account
hub / github.com/pytorch/examples / get_batch

Function get_batch

word_language_model/main.py:136–140  ·  view source on GitHub ↗
(source, i)

Source from the content-addressed store, hash-verified

134# to the seq_len dimension in the LSTM.
135
136def get_batch(source, i):
137 seq_len = min(args.bptt, len(source) - 1 - i)
138 data = source[i:i+seq_len]
139 target = source[i+1:i+1+seq_len].view(-1)
140 return data, target
141
142
143def evaluate(data_source):

Callers 2

evaluateFunction · 0.70
trainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected