gpleiss / temperature_scaling

A simple way to calibrate your neural network.
MIT License
1.09k stars 159 forks source link

Why do we need to expand temperature to match the size of logits? #27

Open FatPandao opened 3 years ago

FatPandao commented 3 years ago

In your code

# Expand temperature to match the size of logits
temperature = self.temperature.unsqueeze(1).expand(logits.size(0), logits.size(1))
return logits / temperature

Why not just doing something like

return logits / self.temperature