don't calculate rank twice
@@ -211,10 +211,6 @@ class TorchRankerAgent(TorchAgent):
# Update loss
self.metrics['loss'] += loss.item()
self.metrics['examples'] += batchsize
- _, ranks = scores.sort(1, descending=True)
- for b in range(batchsize):
- rank = (ranks[b] == label_inds[b]).nonzero().item()
- self.metrics['rank'] += 1 + rank
# Get train predictions
if self.opt['candidates'] == 'batch':
