ac730aec61523031016afc8922c04bfc7a7ac42b,fairseq/sequence_generator.py,SequenceGenerator,_generate,#SequenceGenerator#Any#Any#Any#Any#,168
Before Change
BCList.sort()
BCList.reverse()
finalized[sent] = torch.jit.annotate(
List[Dict[str, Tensor]], [x.elem for x in BCList]
)
return finalized
After Change
// sort by score descending
for sent in range(len(finalized)):
scores = torch.tensor([float(elem["score"].item()) for elem in finalized[sent]])
_, sorted_scores_indices = torch.sort(scores, descending=True)
finalized[sent] = [finalized[sent][ssi] for ssi in sorted_scores_indices]
finalized[sent] = torch.jit.annotate(List[Dict[str, Tensor]], finalized[sent])
return finalized
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 5
Instances
Project Name: pytorch/fairseq
Commit Name: ac730aec61523031016afc8922c04bfc7a7ac42b
Time: 2020-09-03
Author: juancarabina@fb.com
File Name: fairseq/sequence_generator.py
Class Name: SequenceGenerator
Method Name: _generate
Project Name: dmlc/dgl
Commit Name: 6cd7c313f1edf06cdb78527306aa61bc92b73364
Time: 2020-04-23
Author: wmjlyjemaine@gmail.com
File Name: python/dgl/transform.py
Class Name:
Method Name: to_block
Project Name: Microsoft/nni
Commit Name: 6c1fe5c811f82c571af94f787b4721f3a1cc7ca4
Time: 2019-11-25
Author: scottyugochang@gmail.com
File Name: src/sdk/pynni/nni/nas/pytorch/darts/mutator.py
Class Name: DartsMutator
Method Name: sample_final