Skip to content

tenzr::data

Classes

Name
class tenzr::data::BatchSampler
Groups indices produced by a Sampler into fixed-size batches.
class tenzr::data::DataLoader
Iterates a Dataset in batches with optional collation.
struct tenzr::data::DataLoaderOptions
Configuration for a DataLoader.
class tenzr::data::Dataset
Abstract indexed collection of tensor samples.
class tenzr::data::RandomSampler
Sampler that yields a shuffled permutation of the dataset indices.
class tenzr::data::Sampler
Abstract source of index orders over a dataset.
class tenzr::data::SequentialSampler
Sampler that yields indices in ascending order.
class tenzr::data::ShardedDataset
View of a Dataset restricted to the samples owned by one shard.
class tenzr::data::TensorDataset
Dataset backed by an in-memory list of tensors.

Types

Name
using std::function< DataItem(const std::vector< DataItem > &)> CollateFn
using std::vector< Tensor > DataItem

Functions

Name
DataItem DefaultCollate(const std::vector< DataItem > & batch_items)

Types Documentation

using CollateFn

using tenzr::data::CollateFn = typedef std::function<DataItem(const std::vector<DataItem>&)>;

using DataItem

using tenzr::data::DataItem = typedef std::vector<Tensor>;

Functions Documentation

function DefaultCollate

DataItem DefaultCollate(
    const std::vector< DataItem > & batch_items
)

Parameters:

  • batch_items Samples to collate.
  • batch_items Samples to collate; all items in a column must agree in shape and dtype.

Return:

  • Batched tensors.
  • One batched tensor per column.

Default collation: stack per-field tensors along a new leading batch axis. Stack a list of per-sample DataItems column-wise into batched tensors.