Combines consecutive elements of this dataset into padded batches

This method combines multiple consecutive elements of this dataset, which might have different shapes, into a single element. The tensors in the resulting element have an additional outer dimension, and are padded to the respective shape in padded_shapes.

dataset_padded_batch(dataset, batch_size, padded_shapes,
  padding_values = NULL)

Arguments

dataset

A dataset

batch_size

An integer, representing the number of consecutive elements of this dataset to combine in a single batch.

padded_shapes

A nested structure of tf$TensorShape or integer vector tensor-like objects representing the shape to which the respective component of each input element should be padded prior to batching. Any unknown dimensions (e.g. tf$Dimension(NULL) in a tf$TensorShape or -1 in a tensor-like object) will be padded to the maximum size of that dimension in each batch.

padding_values

(Optional) A nested structure of scalar-shaped tf$Tensor, representing the padding values to use for the respective components. Defaults are 0 for numeric types and the empty string for string types.

Value

A dataset

See also

Other dataset methods: dataset_batch, dataset_cache, dataset_concatenate, dataset_decode_delim, dataset_filter, dataset_interleave, dataset_map, dataset_prefetch, dataset_repeat, dataset_shuffle, dataset_skip, dataset_take