def ResNetGenerator(
    name: str = "resnet-18",
    width: float = 1,
    num_classes: int = 10,
    num_splits: int = 0,
) -> ResNet:
    """Builds and returns the specified ResNet.

    Args:
        name:
            ResNet version from resnet-{9, 18, 34, 50, 101, 152}.
        width:
            ResNet width.
        num_classes:
            Output dim of the last layer.
        num_splits:
            Number of splits to use for SplitBatchNorm (for MoCo model).
            Increase this number to simulate multi-gpu behavior.
            E.g. `num_splits=8` simulates a 8-GPU cluster.
            `num_splits=0` uses normal PyTorch BatchNorm.

    Returns:
        ResNet as nn.Module.

    Examples:
        >>> # binary classifier with ResNet-34
        >>> from lightly.models import ResNetGenerator
        >>> resnet = ResNetGenerator('resnet-34', num_classes=2)

    """

    model_params = {
        "resnet-9": {"block": BasicBlock, "layers": [1, 1, 1, 1]},
        "resnet-18": {"block": BasicBlock, "layers": [2, 2, 2, 2]},
        "resnet-34": {"block": BasicBlock, "layers": [3, 4, 6, 3]},
        "resnet-50": {"block": Bottleneck, "layers": [3, 4, 6, 3]},
        "resnet-101": {"block": Bottleneck, "layers": [3, 4, 23, 3]},
        "resnet-152": {"block": Bottleneck, "layers": [3, 8, 36, 3]},
    }

    if name not in model_params.keys():
        raise ValueError(
            "Illegal name: {%s}. \
        Try resnet-9, resnet-18, resnet-34, resnet-50, resnet-101, resnet-152."
            % (name)
        )

    return ResNet(
        **model_params[name],  # type: ignore # Cannot unpack dict to type "ResNet".
        width=width,
        num_classes=num_classes,
        num_splits=num_splits,
    )
Builds and returns the specified ResNet.

    Args:
        name:
            ResNet version from resnet-{9, 18, 34, 50, 101, 152}.
        width:
            ResNet width.
        num_classes:
            Output dim of the last layer.
        num_splits:
            Number of splits to use for SplitBatchNorm (for MoCo model).
            Increase this number to simulate multi-gpu behavior.
            E.g. `num_splits=8` simulates a 8-GPU cluster.
            `num_splits=0` uses normal PyTorch BatchNorm.

    Returns:
        ResNet as nn.Module.

    Examples:
        >>> # binary classifier with ResNet-34
        >>> from lightly.models import ResNetGenerator
        >>> resnet = ResNetGenerator('resnet-34', num_classes=2)

    
lightly/models/resnet.py