batched_resnet#
- torch_uncertainty.models.batched_resnet(in_channels, num_classes, arch, num_estimators, conv_bias=True, dropout_rate=0, width_multiplier=1.0, groups=1, style=ResNetStyle.IMAGENET, normalization_layer=<class 'torch.nn.modules.batchnorm.BatchNorm2d'>, repeat_strategy='paper')[source]#
BatchEnsemble 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.conv_bias (
bool) – Whether to use bias in convolutions. Defaults toTrue.dropout_rate (
float) – Dropout rate. Defaults to0.width_multiplier (
float) – Width multiplier. Defaults to1.0.groups (
int) – Number of groups within each estimator.style (
ResNetStyle) – Whether to use the ImageNet or CIFAR structure. Defaults toResNetStyle.IMAGENET.normalization_layer (
type[Module]) – Normalization layer. Defaults tonn.BatchNorm2d.repeat_strategy (
Literal['legacy','paper']) –The repeatrepeat_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 BatchEnsemble-style ResNet.
- Return type:
_BatchedResNet