def batch_dataset(dataset, batch_size, prefetch_batch=(_N_CPU + 1), drop_remainder=True, filter=None, map_func=None, num_threads=_N_CPU, shuffle=True, buffer_size=4096, repeat=(- 1)):
    if filter:
        dataset = dataset.filter(filter)
    if map_func:
        dataset = dataset.map(map_func, num_parallel_calls=num_threads)
    if shuffle:
        dataset = dataset.shuffle(buffer_size)
    if drop_remainder:
        dataset = dataset.apply(tf.contrib.data.batch_and_drop_remainder(batch_size))
    else:
        dataset = dataset.batch(batch_size)
    dataset = dataset.repeat(repeat).prefetch(prefetch_batch)
    return dataset
def batch_dataset(dataset, batch_size, prefetch_batch=(_N_CPU + 1), drop_remainder=True, filter=None, map_func=None, num_threads=_N_CPU, shuffle=True, buffer_size=4096, repeat=(- 1)):
    if filter:
        dataset = dataset.filter(filter)
    if map_func:
        dataset = dataset.map(map_func, num_parallel_calls=num_threads)
    if shuffle:
        dataset = dataset.shuffle(buffer_size)
    if drop_remainder:
        dataset = dataset.apply(tf.contrib.data.batch_and_drop_remainder(batch_size))
    else:
        dataset = dataset.batch(batch_size)
    dataset = dataset.repeat(repeat).prefetch(prefetch_batch)
    return dataset