class
CrossViTForImageClassification
extends
ImageClassificationModelClassificationHeadMixinCrossViTForImageClassification(config: CrossViTConfig)CrossViT with two per-branch linear heads, output averaged.
Paper §3.3 — the final prediction is the mean of the two branch-specific logits, an implicit two-model ensemble.
Examples
>>> import lucid
>>> from lucid.models.vision.crossvit import (
... CrossViTForImageClassification,
... CrossViTConfig,
... )
>>> model = CrossViTForImageClassification(CrossViTConfig()).eval()
>>> out = model(lucid.randn(1, 3, 240, 240))
>>> out.logits.shape
(1, 1000)
>>> out.loss is None
TrueUsed by 2
Constructors
1Instance methods
2forward(x: Tensor, labels: Tensor | None = None)Replace both branch heads.
CrossViT predicts from two branches and averages their logits, so the
head is a two-entry ModuleList; resetting one would leave the model
emitting a mixture of old and new label spaces. The mixin's default
looks for a single self.classifier and raised AttributeError.