Go to the documentation of this file.
41 template <
typename DType>
48 virtual void Init(
const std::vector<std::pair<std::string, std::string> >& kwargs) = 0;
52 virtual bool Next(
void) = 0;
54 virtual const DType&
Value(
void)
const = 0;
117 #define MXNET_REGISTER_IO_ITER(name) \
118 DMLC_REGISTRY_REGISTER(::mxnet::DataIteratorReg, DataIteratorReg, name)
131 virtual uint64_t
GetLen(
void)
const = 0;
137 virtual bool GetItem(uint64_t idx, std::vector<NDArray>* ret) = 0;
143 typedef std::function<Dataset*(
const std::vector<std::pair<std::string, std::string> >&)>
164 #define MXNET_REGISTER_IO_DATASET(name) \
165 DMLC_REGISTRY_REGISTER(::mxnet::DatasetReg, DatasetReg, name)
172 virtual bool Batchify(
const std::vector<std::vector<NDArray> >& inputs,
173 std::vector<NDArray>* outputs) = 0;
179 typedef std::function<
BatchifyFunction*(
const std::vector<std::pair<std::string, std::string> >&)>
201 #define MXNET_REGISTER_IO_BATCHIFY_FUNCTION(name) \
202 DMLC_REGISTRY_REGISTER(::mxnet::BatchifyFunctionReg, BatchifyFunctionReg, name)
204 #endif // MXNET_IO_H_
namespace of mxnet
Definition: api_registry.h:33
std::string extra_data
extra data to be fed to the network
Definition: io.h:91
std::vector< TBlob > data
content of data
Definition: io.h:77
std::vector< std::string > data_names
store the name of each data, it could be used for making NDArrays
Definition: io.h:58
Common base class for function registry.
Definition: registry.h:151
std::function< BatchifyFunction *(const std::vector< std::pair< std::string, std::string > > &)> BatchifyFunctionFactory
typedef the factory function of data sampler
Definition: io.h:180
std::function< Dataset *(const std::vector< std::pair< std::string, std::string > > &)> DatasetFactory
typedef the factory function of dataset
Definition: io.h:144
A random accessable dataset which provides GetLen() and GetItem(). Unlike DataIter,...
Definition: io.h:126
virtual ~Dataset(void)
Definition: io.h:139
std::function< IIterator< DataBatch > *()> DataIteratorFactory
typedef the factory function of data iterator
Definition: io.h:97
a single data instance
Definition: io.h:73
virtual uint64_t GetLen(void) const =0
Get the size of the dataset.
Registry entry for DataSampler factory functions.
Definition: io.h:184
Registry entry for Dataset factory functions.
Definition: io.h:148
virtual ~BatchifyFunction(void)
Destructor.
Definition: io.h:170
std::vector< NDArray > data
content of dense data, if this DataBatch is dense
Definition: io.h:87
std::string extra_data
extra data to be fed to the network
Definition: io.h:79
virtual void BeforeFirst(void)=0
reset the iterator
Registry entry for DataIterator factory functions.
Definition: io.h:101
iterator type
Definition: io.h:42
std::vector< uint64_t > index
index of image data
Definition: io.h:89
data iterator interface this is not a C++ style iterator, but nice for data pulling:) This interface ...
Definition: data.h:56
virtual bool Batchify(const std::vector< std::vector< NDArray > > &inputs, std::vector< NDArray > *outputs)=0
The batchify logic.
virtual int64_t GetLenHint(void) const
request iterator length hint for current epoch. Note that the returned value can be < 0,...
Definition: io.h:67
virtual ~IIterator(void)
constructor
Definition: io.h:56
unsigned index
unique id for instance
Definition: io.h:75
int num_batch_padd
num of example padded to batch
Definition: io.h:93
virtual const DType & Value(void) const =0
get current data
defines common input data structure, and interface for handling the input data
virtual bool Next(void)=0
move to next item
DataBatch of NDArray, returned by Iterator.
Definition: io.h:85
void SetDataName(const std::string data_name)
set data name to each attribute of data
Definition: io.h:60
Registry utility that helps to build registry singletons.
NDArray interface that handles array arithematics.
virtual bool GetItem(uint64_t idx, std::vector< NDArray > *ret)=0
Get the ndarray items given index in dataset.
virtual void Init(const std::vector< std::pair< std::string, std::string > > &kwargs)=0
set the parameters and init iter
std::shared_ptr< BatchifyFunction > BatchifyFunctionPtr
Definition: io.h:176
configuration of MXNet as well as basic data structure.