Caffe2 - C++ API
A deep learning, cross platform ML framework
Public Types | Public Member Functions
torch::data::datasets::MNIST Class Reference

The MNIST dataset. More...

#include <mnist.h>

Inheritance diagram for torch::data::datasets::MNIST:
torch::data::datasets::Dataset< MNIST > torch::data::datasets::BatchDataset< MNIST, std::vector< Example<> > >

Public Types

enum  Mode { kTrain, kTest }
 The mode in which the dataset is loaded.
 
- Public Types inherited from torch::data::datasets::Dataset< MNIST >
using ExampleType = Example<>
 
- Public Types inherited from torch::data::datasets::BatchDataset< MNIST, std::vector< Example<> > >
using SelfType = MNIST
 
using BatchType = std::vector< Example<> >
 
using BatchRequestType = ArrayRef< size_t >
 

Public Member Functions

 MNIST (const std::string &root, Mode mode=Mode::kTrain)
 Loads the MNIST dataset from the root path. More...
 
Example get (size_t index) override
 Returns the Example at the given index.
 
optional< size_t > size () const override
 Returns the size of the dataset.
 
bool is_train () const noexcept
 Returns true if this is the training subset of MNIST.
 
const Tensorimages () const
 Returns all images stacked into a single tensor.
 
const Tensortargets () const
 Returns all targets stacked into a single tensor.
 
- Public Member Functions inherited from torch::data::datasets::Dataset< MNIST >
std::vector< ExampleTypeget_batch (ArrayRef< size_t > indices) override
 Returns a batch of data. More...
 
- Public Member Functions inherited from torch::data::datasets::BatchDataset< MNIST, std::vector< Example<> > >
MapDataset< MNIST, TransformType > map (TransformType transform)&
 Creates a MapDataset that applies the given transform to this dataset.
 
MapDataset< MNIST, 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< MNIST, std::vector< Example<> > >
static constexpr bool is_stateful
 

Detailed Description

The MNIST dataset.

Definition at line 16 of file mnist.h.

Constructor & Destructor Documentation

torch::data::datasets::MNIST::MNIST ( const std::string &  root,
Mode  mode = Mode::kTrain 
)
explicit

Loads the MNIST dataset from the root path.

The supplied root path should contain the content of the unzipped MNIST dataset, available from http://yann.lecun.com/exdb/mnist.

Definition at line 99 of file mnist.cpp.


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