0cef773c66b325e84900474688a7b0f4f4663f93,utils/eval_utils.py,,get_gt_ranks,#,4
Before Change
ranks = ranks.view(-1, num_opts)
gt_ranks = torch.LongTensor(ans_ind.size(0))
for i in range(ans_ind.size(0)):
gt_binary = torch.zeros(num_opts)
gt_binary[ans_ind[i]] = 1
sorted_gt = gt_binary.index_select(0, ranks[i].sort()[1].cpu())
gt_rank = (sorted_gt == 1).nonzero() + 1
gt_ranks[i] = int(gt_rank) // gt_rank is 1x1 LongTensor
return gt_ranks
After Change
ans_ind = ans_ind.view(-1)
gt_ranks = torch.LongTensor(ans_ind.size(0))
for i in range(ans_ind.size(0)):
gt_ranks[i] = int(ranks[i, ans_ind[i]])
return gt_ranks
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 5
Instances
Project Name: batra-mlp-lab/visdial-challenge-starter-pytorch
Commit Name: 0cef773c66b325e84900474688a7b0f4f4663f93
Time: 2018-07-26
Author: karandesai281196@gmail.com
File Name: utils/eval_utils.py
Class Name:
Method Name: get_gt_ranks
Project Name: facebookresearch/SentEval
Commit Name: d477e70d888d8501cc0834c47f399a4f65a439d9
Time: 2018-07-13
Author: asabran@fb.com
File Name: senteval/tools/classifier.py
Class Name: PyTorchClassifier
Method Name: trainepoch
Project Name: facebookresearch/SentEval
Commit Name: d477e70d888d8501cc0834c47f399a4f65a439d9
Time: 2018-07-13
Author: asabran@fb.com
File Name: senteval/tools/relatedness.py
Class Name: RelatednessPytorch
Method Name: trainepoch