Close
Sidebar
Search tutorials
Get Started
Documentation
XCurve.Losses.AUTKC
We build the model, the loss function, and the optimizer. By default, we use theresnet18
provided by Pytorch. The following class supports the computation of StandardAUTKCLoss:
CLASS StandardAUTKCLoss(surrogate='Sq', K=5, epoch_to_paced=5) [SOURCE]
|
This parameter specifies the surrogate loss, whose options include
This parameter specifies the hyperparameter This parameter specifies the number of warm-up epoch for training. By default, we use the CE loss as the warm-up loss. |
---|
Example:
batch_size, num_class = 32, 10
loss_fn = StandardAUTKCLoss(surrogate='Sq', K=3, epoch_to_paced=0)
preds = torch.randn(batch_size, num_class, requires_grad=True)
targets = torch.empty(batch_size, dtype=torch.long).random_(1)
loss = loss_fn(preds, targets)
loss.backward()