MCPcopy
hub / github.com/quark0/darts / batchify

Function batchify

rnn/utils.py:15–22  ·  view source on GitHub ↗
(data, bsz, args)

Source from the content-addressed store, hash-verified

13
14
15def batchify(data, bsz, args):
16 nbatch = data.size(0) // bsz
17 data = data.narrow(0, 0, nbatch * bsz)
18 data = data.view(bsz, -1).t().contiguous()
19 print(data.size())
20 if args.cuda:
21 data = data.cuda()
22 return data
23
24
25def get_batch(source, i, args, seq_len=None, evaluation=False):

Callers 3

train.pyFile · 0.90
test.pyFile · 0.90
train_search.pyFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected