Template Class MapDataset#
Defined in File map.h
Page Contents
Inheritance Relationships#
Base Type#
public torch::data::datasets::BatchDataset< MapDataset< SourceDataset, AppliedTransform >, detail::optional_if_t< SourceDataset::is_stateful, AppliedTransform::OutputBatchType >, SourceDataset::BatchRequestType >
(Template Class BatchDataset)
Class Documentation#
-
template<typename SourceDataset, typename AppliedTransform>
class MapDataset : public torch::data::datasets::BatchDataset<MapDataset<SourceDataset, AppliedTransform>, detail::optional_if_t<SourceDataset::is_stateful, AppliedTransform::OutputBatchType>, SourceDataset::BatchRequestType># A
MapDataset
is a dataset that applies a transform to a source dataset.Public Types
-
using DatasetType = SourceDataset#
-
using TransformType = AppliedTransform#
-
using BatchRequestType = typename SourceDataset::BatchRequestType#
-
using OutputBatchType = detail::optional_if_t<SourceDataset::is_stateful, typename AppliedTransform::OutputBatchType>#
Public Functions
-
inline MapDataset(DatasetType dataset, TransformType transform)#
-
inline virtual OutputBatchType get_batch(BatchRequestType indices) override#
Gets a batch from the source dataset and applies the transform to it, returning the result.
-
inline virtual std::optional<size_t> size() const noexcept override#
Returns the size of the source dataset.
-
inline void reset()#
Calls
reset()
on the underlying dataset.NOTE: Stateless datasets do not have a reset() method, so a call to this method will only compile for stateful datasets (which have a reset() method).
-
inline const SourceDataset &dataset() noexcept#
Returns the underlying dataset.
-
inline const AppliedTransform &transform() noexcept#
Returns the transform being applied.
-
using DatasetType = SourceDataset#