def _split_into_blocks_generic(sample_values, epoch_size_samples):
    """
    Split an array into blocks of the specified size, the last block may be smaller.
    """
    num_windows = (len(sample_values) + epoch_size_samples - 1) // epoch_size_samples
    epochs = [None] * num_windows
    for index in range(len(epochs)):
        epochs[index] = sample_values[index * epoch_size_samples:(index + 1) * epoch_size_samples]
    return epochs