View source: R/dataset_methods.R
| dataset_batch | R Documentation |
The components of the resulting element will have an additional outer
dimension, which will be batch_size (or N %% batch_size for the last
element if batch_size does not divide the number of input elements N
evenly and drop_remainder is FALSE). If your program depends on the
batches having the same outer dimension, you should set the drop_remainder
argument to TRUE to prevent the smaller batch from being produced.
dataset_batch(
dataset,
batch_size,
drop_remainder = FALSE,
num_parallel_calls = NULL,
deterministic = NULL
)
dataset |
A dataset |
batch_size |
An integer, representing the number of consecutive elements of this dataset to combine in a single batch. |
drop_remainder |
(Optional.) A boolean, representing whether the last
batch should be dropped in the case it has fewer than |
num_parallel_calls |
(Optional.) A scalar integer, representing the
number of batches to compute asynchronously in parallel. If not specified,
batches will be computed sequentially. If the value |
deterministic |
(Optional.) When |
A dataset
If your program requires data to have a statically known shape (e.g.,
when using XLA), you should use drop_remainder=TRUE. Without
drop_remainder=TRUE the shape of the output dataset will have an unknown
leading dimension due to the possibility of a smaller final batch.
Other dataset methods:
dataset_cache(),
dataset_collect(),
dataset_concatenate(),
dataset_decode_delim(),
dataset_filter(),
dataset_interleave(),
dataset_map(),
dataset_map_and_batch(),
dataset_padded_batch(),
dataset_prefetch(),
dataset_prefetch_to_device(),
dataset_reduce(),
dataset_repeat(),
dataset_shuffle(),
dataset_shuffle_and_repeat(),
dataset_skip(),
dataset_take(),
dataset_take_while(),
dataset_window()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.