Caffe2 - C++ API
A deep learning, cross platform ML framework
Public Types | Public Member Functions
torch::data::datasets::MapDataset< SourceDataset, AppliedTransform > Class Template Reference

A MapDataset is a dataset that applies a transform to a source dataset. More...

#include <map.h>

Inheritance diagram for torch::data::datasets::MapDataset< SourceDataset, AppliedTransform >:
torch::data::datasets::BatchDataset< MapDataset< SourceDataset, AppliedTransform >, detail::optional_if_t< SourceDataset::is_stateful, AppliedTransform::OutputBatchType >, SourceDataset::BatchRequestType >

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 Types inherited from torch::data::datasets::BatchDataset< MapDataset< SourceDataset, AppliedTransform >, detail::optional_if_t< SourceDataset::is_stateful, AppliedTransform::OutputBatchType >, SourceDataset::BatchRequestType >
using SelfType = MapDataset< SourceDataset, AppliedTransform >
 
using BatchType = detail::optional_if_t< SourceDataset::is_stateful, AppliedTransform::OutputBatchType >
 
using BatchRequestType = SourceDataset::BatchRequestType
 

Public Member Functions

 MapDataset (DatasetType dataset, TransformType transform)
 
OutputBatchType get_batch (BatchRequestType indices) override
 Gets a batch from the source dataset and applies the transform to it, returning the result. More...
 
optional< size_t > size () const noexceptoverride
 Returns the size of the source dataset.
 
void reset ()
 Calls reset() on the underlying dataset. More...
 
const SourceDataset & dataset () noexcept
 Returns the underlying dataset.
 
const AppliedTransform & transform () noexcept
 Returns the transform being applied.
 
- Public Member Functions inherited from torch::data::datasets::BatchDataset< MapDataset< SourceDataset, AppliedTransform >, detail::optional_if_t< SourceDataset::is_stateful, AppliedTransform::OutputBatchType >, SourceDataset::BatchRequestType >
virtual detail::optional_if_t< SourceDataset::is_stateful, AppliedTransform::OutputBatchType > get_batch (SourceDataset::BatchRequestTyperequest)=0
 Returns a batch of data given an index.
 
MapDataset< MapDataset< SourceDataset, AppliedTransform >, TransformType > map (TransformType transform)&
 Creates a MapDataset that applies the given transform to this dataset.
 
MapDataset< MapDataset< SourceDataset, AppliedTransform >, TransformType > map (TransformType transform)&&
 Creates a MapDataset that applies the given transform to this dataset.
 

Additional Inherited Members

- Static Public Attributes inherited from torch::data::datasets::BatchDataset< MapDataset< SourceDataset, AppliedTransform >, detail::optional_if_t< SourceDataset::is_stateful, AppliedTransform::OutputBatchType >, SourceDataset::BatchRequestType >
static constexpr bool is_stateful
 

Detailed Description

template<typename SourceDataset, typename AppliedTransform>
class torch::data::datasets::MapDataset< SourceDataset, AppliedTransform >

A MapDataset is a dataset that applies a transform to a source dataset.

Definition at line 18 of file base.h.

Member Function Documentation

template<typename SourceDataset, typename AppliedTransform>
OutputBatchType torch::data::datasets::MapDataset< SourceDataset, AppliedTransform >::get_batch ( BatchRequestType  indices)
inlineoverride

Gets a batch from the source dataset and applies the transform to it, returning the result.

Definition at line 41 of file map.h.

template<typename SourceDataset, typename AppliedTransform>
void torch::data::datasets::MapDataset< SourceDataset, AppliedTransform >::reset ( )
inline

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).

Definition at line 54 of file map.h.


The documentation for this class was generated from the following files: