maxlen_b = self.maxlen
for sample in data_itr:
s = utils.make_variable(sample, volatile=True, cuda=cuda)
if "net_input" not in s:
continue
input = s["net_input"]
srclen = input["src_tokens"].size(1)
After Change
maxlen_b = self.maxlen
for sample in data_itr:
s = utils.move_to_cuda(sample) if cuda else sample
if "net_input" not in s:
continue
input = s["net_input"]
srclen = input["src_tokens"].size(1)