Shortcuts

Template Class BatchDataset

Page Contents

Class Documentation

template<typename Self, typename Batch = std::vector<Example<>>, typename BatchRequest = ArrayRef<size_t>>
class torch::data::datasets::BatchDataset

A dataset that can yield data only in batches.

Public Types

using SelfType = Self
using BatchType = Batch
using BatchRequestType = BatchRequest

Public Functions

~BatchDataset() = default
Batch get_batch(BatchRequest request) = 0

Returns a batch of data given an index.

optional<size_t> size() const = 0

Returns the size of the dataset, or an empty optional if it is unsized.

template<typename TransformType>
MapDataset<Self, TransformType> map(TransformType transform) &

Creates a MapDataset that applies the given transform to this dataset.

template<typename TransformType>
MapDataset<Self, TransformType> map(TransformType transform) &&

Creates a MapDataset that applies the given transform to this dataset.

Public Static Attributes

constexpr bool is_stateful = detail::is_optional<BatchType>::value

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources