d0af494e81eb8612cbd688417204d2e21a5d4306,onmt/Loss.py,LossCompute,computeLoss,#LossCompute#Any#Any#Any#Any#Any#Any#,152
Before Change
scores_data = scores.data.clone()
target = target.data.clone()
else:
assert False, "Copy training, coming soon"
// Coverage loss term.
ppl = loss.data.clone()
After Change
// Correct target is copy when only option.
target = target.data.clone()
for i in range(target.size(0)):
if target[i] == 0 and align.data[i] != 0:
target[i] = align.data[i] + len(self.tgt_vocab)
// Coverage loss term.
ppl = loss.data.clone()
stats = Statistics.score(ppl, scores_data, target, pad)
return loss, stats
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 4
Instances
Project Name: OpenNMT/OpenNMT-py
Commit Name: d0af494e81eb8612cbd688417204d2e21a5d4306
Time: 2017-08-23
Author: srush@seas.harvard.edu
File Name: onmt/Loss.py
Class Name: LossCompute
Method Name: computeLoss
Project Name: dmlc/gluon-nlp
Commit Name: a076671d1f0da3d6297cbf3a9afdf1796c2e8e70
Time: 2019-01-06
Author: linhaibin.eric@gmail.com
File Name: src/gluonnlp/data/stream.py
Class Name: SimpleDatasetStream
Method Name: _get_sampler
Project Name: OpenNMT/OpenNMT-py
Commit Name: 7fb5e9256e0e9ddab8ec7854fdf11fcdb5717a45
Time: 2018-09-05
Author: pltrdy@gmail.com
File Name: onmt/inputters/dataset_base.py
Class Name: DatasetBase
Method Name: extract_text_features