25 #ifndef MXNET_CPP_IO_H_ 26 #define MXNET_CPP_IO_H_ 34 #include "dmlc/logging.h" 51 virtual void BeforeFirst(
void) = 0;
52 virtual bool Next(
void) = 0;
53 virtual NDArray GetData(
void) = 0;
54 virtual NDArray GetLabel(
void) = 0;
55 virtual int GetPadNum(
void) = 0;
56 virtual std::vector<int> GetIndex(
void) = 0;
59 return DataBatch{GetData(), GetLabel(), GetPadNum(), GetIndex()};
67 mx_uint num_data_iter_creators = 0;
71 for (
mx_uint i = 0; i < num_data_iter_creators; i++) {
73 const char *description;
75 const char **arg_names;
76 const char **arg_type_infos;
77 const char **arg_descriptions;
79 &num_args, &arg_names, &arg_type_infos,
82 mxdataiter_creators_[name] = data_iter_creators[i];
86 return mxdataiter_creators_[name];
90 std::map<std::string, DataIterCreator> mxdataiter_creators_;
106 explicit MXDataIter(
const std::string &mxdataiter_type);
108 creator_ = other.creator_;
109 params_ = other.params_;
110 blob_ptr_ = other.blob_ptr_;
117 std::vector<int> GetIndex();
125 template <
typename T>
127 std::string value_str;
128 std::stringstream ss;
132 params_[name] = value_str;
138 std::map<std::string, std::string> params_;
139 std::shared_ptr<MXDataIterBlob> blob_ptr_;
145 #endif // MXNET_CPP_IO_H_ MXDataIterBlob(DataIterHandle handle)
Definition: io.h:96
MXDataIter & SetParam(const std::string &name, const T &value)
set config parameters
Definition: io.h:126
void * DataIterHandle
handle to a DataIterator
Definition: c_api.h:80
void Reset()
Definition: io.h:61
MXNET_DLL int MXDataIterFree(DataIterHandle handle)
Free the handle to the IO module.
namespace of mxnet
Definition: base.h:126
DataIterCreator GetMXDataIterCreator(const std::string &name)
Definition: io.h:85
~MXDataIterBlob()
Definition: io.h:97
MXNET_DLL int MXListDataIters(mx_uint *out_size, DataIterCreator **out_array)
List all the available iterator entries.
NDArray interface.
Definition: ndarray.h:120
MXDataIter(const MXDataIter &other)
Definition: io.h:107
MXDataIterMap()
Definition: io.h:66
unsigned int mx_uint
manually define unsigned int
Definition: c_api.h:57
std::vector< int > index
Definition: io.h:47
NDArray label
Definition: io.h:45
DataBatch GetDataBatch()
Definition: io.h:58
NDArray data
Definition: io.h:44
MXDataIterBlob()
Definition: io.h:95
int pad_num
Definition: io.h:46
void * DataIterCreator
handle a dataiter creator
Definition: c_api.h:78
MXNET_DLL int MXDataIterGetIterInfo(DataIterCreator creator, const char **name, const char **description, mx_uint *num_args, const char ***arg_names, const char ***arg_type_infos, const char ***arg_descriptions)
Get the detailed information about data iterator.
DataIterHandle handle_
Definition: io.h:98
Default object for holding a mini-batch of data and related information.
Definition: io.h:42