Skip to content
data

EfficientFormerOutput

extendsImageClassificationOutput
EfficientFormerOutput(logits: Tensor, loss: Tensor | None = None, hidden_states: tuple[Tensor, ...] | None = None, attentions: tuple[Tensor, ...] | None = None, head_logits: Tensor | None = None, head_dist_logits: Tensor | None = None)

Classification output carrying both distillation heads.

The reference keeps head and head_dist separate in training — that separation is the whole point of a distilled dual head, since the two are supervised by different targets (ground truth and the teacher). Averaging before the loss trains a single averaged predictor instead, and left the individual logits unreachable to any caller wanting to apply a distillation objective.

logits stays the averaged value the reference uses at inference, so existing consumers are unaffected.

Attributes

head_logits(Tensor or None, optional)
Logits from the ground-truth classification head.
head_dist_logits(Tensor or None, optional)
Logits from the distillation head.

Examples

>>> import lucid
>>> from lucid.models.vision.efficientformer import EfficientFormerOutput
>>> out = EfficientFormerOutput(logits=lucid.zeros(1, 1000))
>>> out.logits.shape
(1, 1000)
head_logits and head_dist_logits hold the two heads apart
when distillation is on; logits is their average, which is what
inference should read.
>>> out.head_logits is None, out.head_dist_logits is None
(True, True)

Used by 1