def check_transforms_consistency(transformations, warn_gpu_to_cpu: bool = True):
    """
    Checks if the list of transformations has issues with input/output formats
    and devices consistency:

    :param transformations: The list of transformations.
    :param warn_gpu_to_cpu: Warn if ToDevice is used to move tensors from the
        gpu to the cpu.
    :return: True if the list of transformations has no obvious consistency issues.
    """
    had_issues = False

    # All decoders (first operation in the pipeline) return NumPy arrays
    is_numpy = True
    is_cpu = True

    for t in transformations:
        t_def = FFCV_TRANSFORMS_DEFS.get(type(t), None)
        if t_def is None:
            # Unknown operation
            continue

        bad_usage_type = None

        if is_numpy and not t_def.numpy_cpu:
            bad_usage_type = "NumPy arrays"
        elif not is_numpy:
            if is_cpu and not t_def.pytorch_cpu:
                bad_usage_type = "CPU PyTorch Tensors"
            elif (not is_cpu) and not t_def.pytorch_gpu:
                bad_usage_type = "GPU PyTorch Tensors"

        if bad_usage_type is not None:
            warnings.warn(
                f"Transformation {type(t)} cannot be used on "
                f"{bad_usage_type}.\n"
                f"Its registered definition is: {t_def}.\n"
                f"This may lead to issues with Numba..."
            )
            had_issues = True

        if isinstance(t, ToTensorFFCV):
            is_numpy = False
        elif isinstance(t, ToDeviceFFCV):
            if (not is_cpu) and t.device.type == "cpu":
                if warn_gpu_to_cpu:
                    warnings.warn(
                        f"Moving a Tensor from GPU to CPU is quite unusual..."
                    )
                    had_issues = True

            is_cpu = t.device.type == "cpu"

    return not had_issues

    Checks if the list of transformations has issues with input/output formats
    and devices consistency:

    :param transformations: The list of transformations.
    :param warn_gpu_to_cpu: Warn if ToDevice is used to move tensors from the
        gpu to the cpu.
    :return: True if the list of transformations has no obvious consistency issues.
    
avalanche/benchmarks/utils/ffcv_support/ffcv_transform_utils.py