Forward-return dataclass shape — any dataclass whose name ends
with Output (e.g. ImageClassificationOutput,
MaskedLMOutput). Carries at least an logits /
family-specific tensor field plus an optional loss.
The exact field set differs across tasks (logits / boxes / masks
/ samples / hidden_states / past_key_values / …), so the protocol
intentionally requires only the structural __dataclass_fields__
witness — no concrete field constraint.
Attributes
__dataclass_fields__ClassVar[dict[str, Any]]Standard attribute set by
dataclasses.dataclass.Notes
Output dataclasses are hidden from the docs sidebar
(_model.py 4-slot rule, slot 4) because they are return
types rather than user-facing entry points. The protocol is
still useful for return-type hints in framework utilities (e.g.
metrics computation, loss aggregation) that accept any output
shape.
Examples
>>> from lucid.models import ImageClassificationOutput
>>> from lucid.models._protocols import OutputDataclassProtocol
>>> isinstance(ImageClassificationOutput, OutputDataclassProtocol)
True