def preprocess_output_indices(
    output_indices: Optional[list[int]], model_num_blocks: int, depth: int
) -> list[int]:
    """
    Preprocess the output indices for the encoder.
    """

    # Refine encoder output indices
    if output_indices is None:
        output_indices = sample_block_indices_uniformly(depth, model_num_blocks)
    elif not isinstance(output_indices, (list, tuple)):
        raise ValueError(
            f"`output_indices` for encoder should be a list/tuple/None, got {type(output_indices)}"
        )
    validate_output_indices(output_indices, model_num_blocks, depth)

    return output_indices

    Preprocess the output indices for the encoder.
    
segmentation_models_pytorch/encoders/timm_vit.py