6805be9179b0dde701296a7ed69feea1b26a3a48,pytorch_translate/dual_learning/dual_learning_criterion.py,UnsupervisedCriterion,forward,#UnsupervisedCriterion#Any#Any#Any#Any#Any#Any#Any#Any#Any#,67
Before Change
tgt_hypo = self._maybe_reverse_source(tgt_hypo_processed)
// use bleu score as reward
scorer = bleu.Scorer(src_dict.pad(), src_dict.eos(), src_dict.unk())
assert len(src_hypos) == 1
src_hypo = src_hypos[0]["tokens"][:-1]
scorer.add(src.int().cpu(), src_hypo.int().cpu())
backward_reward = (
After Change
tgt_hypo = self._maybe_reverse_source(tgt_hypo_processed)
// use bleu score as reward
scorer = bleu.Scorer(
bleu.BleuConfig(
pad=src_dict.pad(),
eos=src_dict.eos(),
unk=src_dict.unk(),
)
)
assert len(src_hypos) == 1
src_hypo = src_hypos[0]["tokens"][:-1]
scorer.add(src.int().cpu(), src_hypo.int().cpu())
backward_reward = (
In pattern: SUPERPATTERN
Frequency: 4
Non-data size: 3
Instances
Project Name: pytorch/translate
Commit Name: 6805be9179b0dde701296a7ed69feea1b26a3a48
Time: 2020-10-20
Author: alexei.b@gmail.com
File Name: pytorch_translate/dual_learning/dual_learning_criterion.py
Class Name: UnsupervisedCriterion
Method Name: forward
Project Name: pytorch/translate
Commit Name: 6805be9179b0dde701296a7ed69feea1b26a3a48
Time: 2020-10-20
Author: alexei.b@gmail.com
File Name: pytorch_translate/rescoring/weights_search.py
Class Name:
Method Name: evaluate_weights
Project Name: pytorch/translate
Commit Name: 6805be9179b0dde701296a7ed69feea1b26a3a48
Time: 2020-10-20
Author: alexei.b@gmail.com
File Name: pytorch_translate/sequence_criterions.py
Class Name: BaseSequenceLossCriterion
Method Name: __init__
Project Name: pytorch/translate
Commit Name: 6805be9179b0dde701296a7ed69feea1b26a3a48
Time: 2020-10-20
Author: alexei.b@gmail.com
File Name: pytorch_translate/rescoring/weights_search.py
Class Name:
Method Name: random_search