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, drop_remainder = FALSE)
A dataset
An integer, representing the number of consecutive elements of this dataset to combine in a single batch.
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.
(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.
Ensure that batches have a fixed size by omitting any final smaller batch if it's present. Note that this is required for use with the Keras tensor inputs to fit/evaluate/etc.
A dataset
Other dataset methods: dataset_batch
,
dataset_cache
,
dataset_concatenate
,
dataset_decode_delim
,
dataset_filter
,
dataset_interleave
,
dataset_map_and_batch
,
dataset_map
,
dataset_prefetch_to_device
,
dataset_prefetch
,
dataset_repeat
,
dataset_shuffle_and_repeat
,
dataset_shuffle
,
dataset_skip
, dataset_take