prefix_tokens=s["target"][:, :prefix_size] if prefix_size > 0 else None,
)
if timer is not None:
timer.stop(s["ntokens"])
for i, id in enumerate(s["id"].data):
src = input["src_tokens"].data[i, :]
// remove padding from ref
ref = utils.strip_pad(s["target"].data[i, :], self.pad)
After Change
prefix_tokens=s["target"][:, :prefix_size] if prefix_size > 0 else None,
)
if timer is not None:
timer.stop(sum([len(h[0]["tokens"]) for h in hypos]))
for i, id in enumerate(s["id"].data):
src = input["src_tokens"].data[i, :]
// remove padding from ref