masked_resnet#
- torch_uncertainty.models.masked_resnet(in_channels, num_classes, arch, num_estimators, scale, width_multiplier=1.0, groups=1, conv_bias=True, dropout_rate=0, style=ResNetStyle.IMAGENET, normalization_layer=<class 'torch.nn.modules.batchnorm.BatchNorm2d'>, repeat_strategy='paper')[source]#
Masksembles of ResNet.
- Parameters:
in_channels (
int) – Number of input channels.num_classes (
int) – Number of classes to predict.arch (
int) – The architecture of the ResNet.num_estimators (
int) – Number of estimators in the ensemble.scale (
float) – The scale of the mask.width_multiplier (
float) – Width multiplier. Defaults to1.groups (
int) – Number of groups within each estimator. Defaults to1.conv_bias (
bool) – Whether to use bias in convolutions. Defaults toTrue.dropout_rate (
float) – Dropout rate. Defaults to0.style (
ResNetStyle) – Whether to use the ImageNet or CIFAR structure. Defaults toResNetStyle.IMAGENET.normalization_layer (
type[Module]) – Normalization layer. Defaults tonn.BatchNorm2d.repeat_strategy ("legacy"|"paper") –
The repeat strategy to use during training:
”legacy”: Repeat inputs for each estimator during both training and evaluation.
”paper”(default): Repeat inputs for each estimator only during evaluation.
- Returns:
A Masksembles-style ResNet.
- Return type:
_MaskedResNet