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='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 to 1.

  • groups (int) – Number of groups within each estimator. Defaults to 1.

  • conv_bias (bool) – Whether to use bias in convolutions. Defaults to True.

  • dropout_rate (float) – Dropout rate. Defaults to 0.

  • style (str, optional) – The style of the model. Defaults to "imagenet".

  • normalization_layer (nn.Module, optional) – Normalization layer.

  • repeat_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 Masksembles-style ResNet.

Return type:

_MaskedResNet