def _tile2latent_indices(
    tile_row, tile_col, tile_width, tile_height, tile_row_overlap, tile_col_overlap, image_width, image_height
):
    """Given a tile row and column numbers returns the range of latents affected by that tiles in the overall image

    Returns a tuple with:
        - Starting coordinates of rows in latent space
        - Ending coordinates of rows in latent space
        - Starting coordinates of columns in latent space
        - Ending coordinates of columns in latent space
    """
    # Get pixel indices
    px_row_init, px_row_end, px_col_init, px_col_end = _tile2pixel_indices(
        tile_row, tile_col, tile_width, tile_height, tile_row_overlap, tile_col_overlap, image_width, image_height
    )

    # Convert to latent space
    latent_row_init = px_row_init // 8
    latent_row_end = px_row_end // 8
    latent_col_init = px_col_init // 8
    latent_col_end = px_col_end // 8
    latent_height = image_height // 8
    latent_width = image_width // 8

    # Ensure the last tile does not exceed the latent dimensions
    latent_row_end = min(latent_row_end, latent_height)
    latent_col_end = min(latent_col_end, latent_width)

    return latent_row_init, latent_row_end, latent_col_init, latent_col_end
Given a tile row and column numbers returns the range of latents affected by that tiles in the overall image

    Returns a tuple with:
        - Starting coordinates of rows in latent space
        - Ending coordinates of rows in latent space
        - Starting coordinates of columns in latent space
        - Ending coordinates of columns in latent space
    
examples/community/mod_controlnet_tile_sr_sdxl.py