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='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 to
True.dropout_rate (float) – Dropout rate. Defaults to
0.width_multiplier (float) – Width multiplier. Defaults to
1.0.groups (int) – Number of groups within each estimator.
style (bool, optional) – Whether to use the ImageNet structure. Defaults to
True.normalization_layer (nn.Module, optional) – Normalization layer.
repeat_strategy (Literal["legacy", "paper"], optional) –
The repeatrepeat_strategy (“legacy”|”paper”, optional): 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