import math


def calc_lowest_possible_scale(level, kernel_size, num_layers):
    """Calculates the lowest size the generator will accept in each dimension.
    It depends on the number/size of layers."""
    needed_pad = math.floor(kernel_size/2) * num_layers
    min_size = (needed_pad * 2) + 2
    sizes = level.shape[2:]
    lowest_scales = []
    for dim in sizes:
        lowest_scales.append(min_size/dim)
    return lowest_scales