def disable_antialiasing(transform: Transform) -> Transform:
    """Disable antialiasing in Resize transforms.

    This function recursively disables antialiasing in any ``Resize`` transforms found
    within the provided transform or transform composition. This is necessary because
    antialiasing is not supported during ONNX export.

    Args:
        transform (Transform): Transform or composition of transforms to process.

    Returns:
        Transform: The processed transform with antialiasing disabled in any
            ``Resize`` transforms.

    Example:
        >>> from torchvision.transforms.v2 import Compose, Resize
        >>> transform = Compose([
        ...     Resize((224, 224), antialias=True),
        ...     Resize((256, 256), antialias=True)
        ... ])
        >>> transform = disable_antialiasing(transform)
        >>> # Now all Resize transforms have antialias=False

    Note:
        This function modifies the transforms in-place by setting their
        ``antialias`` attribute to ``False``. The original transform object is
        returned.
    """
    if isinstance(transform, Resize):
        transform.antialias = False
    if isinstance(transform, Compose):
        for tr in transform.transforms:
            disable_antialiasing(tr)
    return transform
Disable antialiasing in Resize transforms.

    This function recursively disables antialiasing in any ``Resize`` transforms found
    within the provided transform or transform composition. This is necessary because
    antialiasing is not supported during ONNX export.

    Args:
        transform (Transform): Transform or composition of transforms to process.

    Returns:
        Transform: The processed transform with antialiasing disabled in any
            ``Resize`` transforms.

    Example:
        >>> from torchvision.transforms.v2 import Compose, Resize
        >>> transform = Compose([
        ...     Resize((224, 224), antialias=True),
        ...     Resize((256, 256), antialias=True)
        ... ])
        >>> transform = disable_antialiasing(transform)
        >>> # Now all Resize transforms have antialias=False

    Note:
        This function modifies the transforms in-place by setting their
        ``antialias`` attribute to ``False``. The original transform object is
        returned.
    
src/anomalib/pre_processing/utils/transform.py