deepr.prepros.PaddedBatch

class deepr.prepros.PaddedBatch(batch_size, fields, drop_remainder=False)[source]

Combines consecutive elements of a dataset into padded batches.

NOTE: this applies on dataset yielding dictionaries ONLY.

If you want to create padded batches from other structures, you need to create your own padded batch prepro wrapping the tensorflow implementation. For example:

@deepr.prepros.prepro
def PaddedBatchDefault(dataset, batch_size, padded_shapes, padding_values):
    return dataset.padded_batch(bath_size, padded_shapes, padding_values)
batch_size

Size of batches

Type:

int

fields

Field information for each key of yielded dictionaries

Type:

Iterable[Field]

modes

Active modes for the map (will skip modes not in modes). Default is None (all modes are considered active modes).

Type:

Iterable[str], Optional

__init__(batch_size, fields, drop_remainder=False)[source]

Methods

__init__(batch_size, fields[, drop_remainder])

apply(dataset[, mode])

Pre-process a dataset