def get_feature_extractor(backbone: str, input_size: tuple[int, int] = (256, 256)) -> nn.Module:
    """Get feature extractor based on specified backbone architecture.

    This function returns a feature extractor model based on the specified backbone
    architecture. Currently supported backbones are defined in ``AVAILABLE_EXTRACTORS``.

    Args:
        backbone (str): Name of the backbone architecture to use. Must be one of
            ``["mcait", "resnet18", "wide_resnet50_2"]``.
        input_size (tuple[int, int], optional): Input image dimensions as
            ``(height, width)``. Defaults to ``(256, 256)``.

    Returns:
        nn.Module: Feature extractor model instance.

    Raises:
        ValueError: If ``backbone`` is not one of the supported architectures in
            ``AVAILABLE_EXTRACTORS``.

    Example:
        >>> from anomalib.models.image.uflow.feature_extraction import get_feature_extractor
        >>> extractor = get_feature_extractor(backbone="resnet18")
        >>> features = extractor(torch.randn(1, 3, 256, 256))

    See Also:
        - :class:`LayerNormFeatureExtractor`: Main feature extractor implementation
        - :class:`CaitFeatureExtractor`: Alternative feature extractor
    """
    if backbone not in AVAILABLE_EXTRACTORS:
        msg = f"Feature extractor must be one of {AVAILABLE_EXTRACTORS}."
        raise ValueError(msg)

    feature_extractor: nn.Module
    if backbone in {"resnet18", "wide_resnet50_2"}:
        feature_extractor = LayerNormFeatureExtractor(
            backbone,
            input_size,
            layers=("layer1", "layer2", "layer3"),
        ).eval()
    if backbone == "mcait":
        feature_extractor = CaitFeatureExtractor().eval()

    return feature_extractor
Get feature extractor based on specified backbone architecture.

    This function returns a feature extractor model based on the specified backbone
    architecture. Currently supported backbones are defined in ``AVAILABLE_EXTRACTORS``.

    Args:
        backbone (str): Name of the backbone architecture to use. Must be one of
            ``["mcait", "resnet18", "wide_resnet50_2"]``.
        input_size (tuple[int, int], optional): Input image dimensions as
            ``(height, width)``. Defaults to ``(256, 256)``.

    Returns:
        nn.Module: Feature extractor model instance.

    Raises:
        ValueError: If ``backbone`` is not one of the supported architectures in
            ``AVAILABLE_EXTRACTORS``.

    Example:
        >>> from anomalib.models.image.uflow.feature_extraction import get_feature_extractor
        >>> extractor = get_feature_extractor(backbone="resnet18")
        >>> features = extractor(torch.randn(1, 3, 256, 256))

    See Also:
        - :class:`LayerNormFeatureExtractor`: Main feature extractor implementation
        - :class:`CaitFeatureExtractor`: Alternative feature extractor
    
src/anomalib/models/image/uflow/feature_extraction.py