SupContrast
SupContrast copied to clipboard
Why use logits without exp() and log() - torch.log(exp_logits)
# compute log_prob
exp_logits = torch.exp(logits) * logits_mask
log_prob = logits - torch.log(exp_logits.sum(1, keepdim=True))
In the code of loss, the logits without exp() and log(), why it can minus a log_exp_logit? It is different with Eq.(2) of SupContrast paper.
Thank you for your help.
Because if you take the log over the exp, it gives the original value of logits.
I still did not understand the calculation of loss. Did you figure it out? Can anyone explain a little bit more?
I still did not understand the calculation of loss. Did you figure it out? Can anyone explain a little bit more?
log(a/b) = log(a)-log(b)