Any way to get confidence (for class predictions) from Variable?

Is there a way to return classification results as confidence scores from a pyTorch Variable? I can easily retrieve topk results from Variable but they’re just floats with various negative/positive values (e.g. [-0.201, 5.627, 0.982, 3.221]. I’m looking to get the confidence instead (where all numbers sum up to 1.0 e.g. [0.84, 0.11, 0.026, 0.024]) Does anyone know how to obtain/compute this?

Thanks

You are looking for softmax. Most(all?) pretrained in torch vision don’t have final softmax.

1 Like

Thank you, that’s exactly what I was looking for.