A dataset that can yield data in batches, or as individual examples. More...
#include <base.h>
Public Types | |
using | ExampleType = SingleExample |
Public Types inherited from torch::data::datasets::BatchDataset< Self, std::vector< SingleExample > > | |
using | SelfType = Self |
using | BatchType = std::vector< SingleExample > |
using | BatchRequestType = ArrayRef< size_t > |
Public Member Functions | |
virtual ExampleType | get (size_t index)=0 |
Returns the example at the given index. | |
std::vector< ExampleType > | get_batch (ArrayRef< size_t > indices) override |
Returns a batch of data. More... | |
Public Member Functions inherited from torch::data::datasets::BatchDataset< Self, std::vector< SingleExample > > | |
virtual optional< size_t > | size () const =0 |
Returns the size of the dataset, or an empty optional if it is unsized. | |
MapDataset< Self, TransformType > | map (TransformType transform)& |
Creates a MapDataset that applies the given transform to this dataset. | |
MapDataset< Self, TransformType > | map (TransformType transform)&& |
Creates a MapDataset that applies the given transform to this dataset. | |
Additional Inherited Members | |
Static Public Attributes inherited from torch::data::datasets::BatchDataset< Self, std::vector< SingleExample > > | |
static constexpr bool | is_stateful |
A dataset that can yield data in batches, or as individual examples.
A Dataset
is a BatchDataset
, because it supports random access and therefore batched access is implemented (by default) by calling the random access indexing function for each index in the requested batch of indices. This can be customized.
|
inlineoverridevirtual |
Returns a batch of data.
The default implementation calls get()
for every requested index in the batch.
Implements torch::data::datasets::BatchDataset< Self, std::vector< SingleExample > >.