0cef773c66b325e84900474688a7b0f4f4663f93,utils/eval_utils.py,,get_gt_ranks,#Any#Any#,4
Before Change
def get_gt_ranks(ranks, ans_ind):
ans_ind = ans_ind.view(-1)
num_opts = 100
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: 6
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: bearpaw/pytorch-pose
Commit Name: 7ce6642f777e9da6249bd5b05330d57fa09ea37a
Time: 2019-01-07
Author: platero.yang@gmail.com
File Name: example/mpii.py
Class Name:
Method Name: train
Project Name: PacktPublishing/Deep-Reinforcement-Learning-Hands-On
Commit Name: ca7a5e9a39478054dbdfbfba9963b13c80b768f8
Time: 2018-03-14
Author: max.lapan@gmail.com
File Name: ch18/telegram-bot.py
Class Name: Session
Method Name: move_bot