tenzr::data::ShardedDataset¶
View of a Dataset restricted to the samples owned by one shard.
#include <dataset.h>
Inherits from tenzr::data::Dataset
Public Functions¶
| Name | |
|---|---|
| ShardedDataset(std::shared_ptr< Dataset > base_dataset, size_t num_shards, size_t shard_index) | |
| virtual size_t | Size() const override |
| virtual DataItem | Get(size_t index) const override |
| size_t | NumShards() const |
| size_t | ShardIndex() const |
Additional inherited members¶
Public Functions inherited from tenzr::data::Dataset
| Name | |
|---|---|
| virtual | ~Dataset() =default |
Public Functions Documentation¶
function ShardedDataset¶
Parameters:
- base_dataset Dataset to partition; must not be null.
- num_shards Total number of shards, each index i with i % num_shards == shard_index.
- shard_index This shard's index, in [0, num_shards).
View base_dataset through a strided shard assigned to shard_index.
function Size¶
Return: Number of samples in this shard.
Reimplements: tenzr::data::Dataset::Size
function Get¶
Parameters:
- index Zero-based index within the shard.
Return: Base-dataset sample.
Reimplements: tenzr::data::Dataset::Get
Fetch a sample from this shard.
function NumShards¶
Return: Total number of shards.
function ShardIndex¶
Return: Zero-based index of this shard.