register_weights(model_name: str)Class decorator registering a WeightsEnum for discovery.
Parameters
model_namestrThe factory name the enum belongs to (e.g.
"resnet_18").Returns
Callable[[type[WeightsEnum]], type[WeightsEnum]]A decorator that records the enum under both model_name
(for list_pretrained) and the enum's class name (for
get_weight), then returns the class unchanged.
Examples
>>> @register_weights("resnet_18")
... class ResNet18Weights(WeightsEnum):
... IMAGENET1K_V1 = WeightEntry(...)
... DEFAULT = IMAGENET1K_V1