tenzr::data::DataLoader¶
Iterates a Dataset in batches with optional collation.
#include <dataloader.h>
Public Classes¶
| Name | |
|---|---|
| class | Iterator Forward iterator over the batches of a DataLoader. |
Public Functions¶
| Name | |
|---|---|
| DataLoader(std::shared_ptr< Dataset > dataset, DataLoaderOptions options, CollateFn collate_fn =nullptr) | |
| ~DataLoader() | |
| DataLoader(const DataLoader & ) =delete | |
| DataLoader & | operator=(const DataLoader & ) =delete |
| DataLoader(DataLoader && ) | |
| DataLoader & | operator=(DataLoader && ) |
| Iterator | begin() |
| Iterator | end() |
| size_t | Size() const |
| size_t | DatasetSize() const |
| const DataLoaderOptions & | Options() const |
Friends¶
| Name | |
|---|---|
| class | Iterator |
Public Functions Documentation¶
function DataLoader¶
DataLoader(
std::shared_ptr< Dataset > dataset,
DataLoaderOptions options,
CollateFn collate_fn =nullptr
)
Parameters:
- dataset Dataset to iterate; must not be null.
- options Batching, shuffling, and worker settings.
- collate_fn Optional collate function.
Create a loader over dataset, defaulting to default_collate when none is supplied.
function ~DataLoader¶
function DataLoader¶
function operator=¶
function DataLoader¶
function operator=¶
function begin¶
Return:
- Iterator to the first batch.
- Beginning iterator.
Iterator to the first batch.
function end¶
Return:
- Past-the-end iterator.
- End iterator.
Sentinel iterator past the last batch.
function Size¶
Return:
- Number of batches.
- Batch count.
Number of batches per epoch.
function DatasetSize¶
Return:
- Number of samples in the dataset.
- Dataset size.
Number of samples in the underlying dataset.
function Options¶
Return: Const reference to the loader configuration.