-
Notifications
You must be signed in to change notification settings - Fork 2
temperature scaling #1
Copy link
Copy link
Open
Description
It's a really nice repo. I read your paper and wondering the baseline you set is MSP+Temperature Scaling?
But I could not find the Temperture Scaling operations in your code.
parser.add_argument('--cwd_weight', default=0.1, type=float, help='Trianing time tempscaling') the option here
class KDLoss(nn.Module):
def init(self, temp_factor):
super(KDLoss, self).init()
self.temp_factor = temp_factor
self.kl_div = nn.KLDivLoss(reduction="sum")
def forward(self, input, target):
log_p = torch.log_softmax(input/self.temp_factor, dim=1)
q = torch.softmax(target/self.temp_factor, dim=1)
loss = self.kl_div(log_p, q)*(self.temp_factor**2)/input.size(0)
return loss
kdloss = KDLoss(2.0) the KDL loss here.
And Temperre Scaling is used in training time not inference? You said it's a post-hoc method, so you should use it in your inference time? Could you help me with this confusion?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels