Skip to content
data

GoogLeNetOutput

extendsImageClassificationOutput
GoogLeNetOutput(logits: Tensor, loss: Tensor | None = None, hidden_states: tuple[Tensor, ...] | None = None, attentions: tuple[Tensor, ...] | None = None, aux_logits1: Tensor | None = None, aux_logits2: Tensor | None = None)

Structured forward output for GoogLeNetForImageClassification.

Carries the main classifier logits plus the optional auxiliary classifier logits emitted during training. Auxiliary heads attach at Inception 4a and 4d in the original paper and are evaluated only in training mode when config.aux_logits=True; at inference both auxiliary fields are None.

Parameters

logitsTensor
Main classifier output of shape (B, num_classes).
lossTensor or None= None
Cross-entropy loss including auxiliary terms when labels were passed to GoogLeNetForImageClassification.forward; None otherwise.
aux_logits1Tensor or None= None
Logits from the first auxiliary classifier (attached at Inception 4a) of shape (B, num_classes); None at inference or when aux_logits=False.
aux_logits2Tensor or None= None
Logits from the second auxiliary classifier (attached at Inception 4d) of shape (B, num_classes); None at inference or when aux_logits=False.

Notes

From Szegedy et al., "Going Deeper with Convolutions", CVPR 2015, §5. When auxiliary heads are active the training loss combines the main and auxiliary cross-entropies as

L=Lmain+0.3⋅Laux1+0.3⋅Laux2,\mathcal{L} = \mathcal{L}_{\text{main}} + 0.3 \cdot \mathcal{L}_{\text{aux1}} + 0.3 \cdot \mathcal{L}_{\text{aux2}},

a weighting taken directly from the paper that compensates for the auxiliary heads' shallower position in the network.

Examples

>>> import lucid
>>> from lucid.models.vision.googlenet import googlenet_cls
>>> model = googlenet_cls().eval()
>>> x = lucid.randn(1, 3, 224, 224)
>>> out = model(x)
>>> out.logits.shape
(1, 1000)
>>> out.aux_logits1 is None
True

Used by 1