...
for step, input in dataloader:
    outptut = model(input)  
    # top_prob, _ = torch.topk(F.softmax(output, dim=1)[0], 1)
    loss = criterion(output, label)


I want to weight the highest probability of softmax to the loss.
ex)
If, prob of softmax : 0.75 ->  Effect of this sample * 0.75
If, prob of softmax : 0.12 ->  Effect of this sample * 0.12
But the top_prob is the list (length == batch size)
like top_prob = [0.72, 0.75, 0.82, ... 0.94]
and loss is one scalar value.
(It means the loss is already computed with all elements of a batch.)
How to apply the probability of softmax to the loss ?