Base class for per-architecture pretrained-weight enums.
Each architecture subclasses WeightsEnum and lists its
tagged checkpoints as members whose values are WeightEntry
instances:
class ResNet18Weights(WeightsEnum): IMAGENET1K_V1 = WeightEntry(url=..., sha256=..., ...) DEFAULT = IMAGENET1K_V1
Members expose the underlying entry's fields directly
(ResNet18Weights.IMAGENET1K_V1.url) plus the tag name
(.tag), so call sites read naturally. Assigning
DEFAULT = IMAGENET1K_V1 makes DEFAULT an alias of the
canonical member (standard enum behaviour for duplicate
values), exactly mirroring the torchvision convention where
DEFAULT tracks the strongest available weights.
Notes
The enum.Enum value of each member is a frozen
WeightEntry. Accessing .value returns that entry; the
convenience properties below forward to it.
Used by 3
Properties
6entry: WeightEntryThe underlying WeightEntry value.
Provenance + metrics dict (see WeightEntry.meta).
Output-class count of this checkpoint's head.
Expected SHA-256 of this checkpoint.
The variant tag (member name), e.g. "IMAGENET1K_V1".
For the DEFAULT alias this resolves to the canonical
member's name (the one it aliases), not the literal string
"DEFAULT".
Download URL of this checkpoint (see WeightEntry.url).
Instance methods
1Return the preprocessing pipeline the weights expect.
Returns
TransformCallable transform; apply to a lucid.Tensor image
before feeding the model.
Examples
>>> weights = ResNet18Weights.IMAGENET1K_V1
>>> preprocess = weights.transforms()
>>> x = preprocess(image) # image: lucid.Tensor (C, H, W)
>>> logits = model(x[None])