def mini_slices(n_samples, batch_size):
    """
    Description: Yield slices of size `batch_size` that work with a container of length 'n_samples'.
    """
    n_batches, rest = divmod(n_samples, batch_size)
    if rest != 0:
        n_batches += 1

    return [slice(i * batch_size, (i + 1) * batch_size) for i in range(n_batches)]