26 #ifndef MXNET_CPP_IO_H_ 27 #define MXNET_CPP_IO_H_ 35 #include "dmlc/logging.h" 52 virtual void BeforeFirst(
void) = 0;
53 virtual bool Next(
void) = 0;
54 virtual NDArray GetData(
void) = 0;
55 virtual NDArray GetLabel(
void) = 0;
56 virtual int GetPadNum(
void) = 0;
57 virtual std::vector<int> GetIndex(
void) = 0;
60 return DataBatch{GetData(), GetLabel(), GetPadNum(), GetIndex()};
68 mx_uint num_data_iter_creators = 0;
72 for (
mx_uint i = 0; i < num_data_iter_creators; i++) {
74 const char *description;
76 const char **arg_names;
77 const char **arg_type_infos;
78 const char **arg_descriptions;
80 &num_args, &arg_names, &arg_type_infos,
83 mxdataiter_creators_[name] = data_iter_creators[i];
87 return mxdataiter_creators_[name];
91 std::map<std::string, DataIterCreator> mxdataiter_creators_;
107 explicit MXDataIter(
const std::string &mxdataiter_type);
109 creator_ = other.creator_;
110 params_ = other.params_;
111 blob_ptr_ = other.blob_ptr_;
118 std::vector<int> GetIndex();
126 template <
typename T>
128 std::string value_str;
129 std::stringstream ss;
133 params_[name] = value_str;
139 std::map<std::string, std::string> params_;
140 std::shared_ptr<MXDataIterBlob> blob_ptr_;
146 #endif // MXNET_CPP_IO_H_ MXDataIterBlob(DataIterHandle handle)
Definition: io.h:97
MXDataIter & SetParam(const std::string &name, const T &value)
set config parameters
Definition: io.h:127
void * DataIterHandle
handle to a DataIterator
Definition: c_api.h:81
void Reset()
Definition: io.h:62
MXNET_DLL int MXDataIterFree(DataIterHandle handle)
Free the handle to the IO module.
namespace of mxnet
Definition: base.h:127
DataIterCreator GetMXDataIterCreator(const std::string &name)
Definition: io.h:86
~MXDataIterBlob()
Definition: io.h:98
MXNET_DLL int MXListDataIters(mx_uint *out_size, DataIterCreator **out_array)
List all the available iterator entries.
NDArray interface.
Definition: ndarray.h:121
MXDataIter(const MXDataIter &other)
Definition: io.h:108
MXDataIterMap()
Definition: io.h:67
unsigned int mx_uint
manually define unsigned int
Definition: c_api.h:58
std::vector< int > index
Definition: io.h:48
NDArray label
Definition: io.h:46
DataBatch GetDataBatch()
Definition: io.h:59
NDArray data
Definition: io.h:45
MXDataIterBlob()
Definition: io.h:96
int pad_num
Definition: io.h:47
void * DataIterCreator
handle a dataiter creator
Definition: c_api.h:79
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:99
Default object for holding a mini-batch of data and related information.
Definition: io.h:43