f4beaac559e00a3676d942dc7e8fea69efc01cfe,catalyst/metrics/avg_precision.py,,mean_avg_precision,#Any#Any#Any#,74
Before Change
size: [len(top_k), 1]
map_k_tuple = tuple(
torch.mean(avg_precision(outputs, targets, k)).item() for k in top_k
)
return map_k_tuple
After Change
results = []
for k in topk:
k = min(outputs.size(1), k)
results.append(torch.mean(avg_precision(outputs, targets)[:k]))
return results
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 4
Instances
Project Name: Scitator/catalyst
Commit Name: f4beaac559e00a3676d942dc7e8fea69efc01cfe
Time: 2020-11-30
Author: raveforlive@gmail.com
File Name: catalyst/metrics/avg_precision.py
Class Name:
Method Name: mean_avg_precision
Project Name: facebookresearch/ParlAI
Commit Name: 5b4221cfdb9406e2eb199f4e2cfe1c24ab475d7b
Time: 2019-08-07
Author: ahm@fb.com
File Name: parlai/core/torch_ranker_agent.py
Class Name: TorchRankerAgent
Method Name: eval_step