functional#
A collection of functional utilities for OCL.
Functions#
Hinton's distillation loss [1] . |
- capymoa.ocl.util.functional.hinton_distillation_loss( ) Tensor[source]#
Hinton’s distillation loss [1] .
\[L_{KD} = T^2 KL(softmax(z_t / T), softmax(z_s / T))\]where \(T\) is the temperature, \(z_s\) are the student logits, and \(z_t\) are the teacher logits.
- Parameters:
teacher_logits – Teacher logits of shape
(batch_size, num_classes).student_logits – Student logits of shape
(batch_size, num_classes).temperature – Temperature for distillation. Higher values produce softer probability distributions.
- Returns:
The distillation loss as a scalar tensor.