rahul003 commented on a change in pull request #10533: [MXNET-314] [WIP] 
Support Integer Type parsing in CSVIter
URL: https://github.com/apache/incubator-mxnet/pull/10533#discussion_r181238273
 
 

 ##########
 File path: src/io/iter_csv.cc
 ##########
 @@ -128,23 +229,45 @@ class CSVIter: public IIterator<DataInst> {
     const real_t* ptr = row.value;
     return TBlob((real_t*)ptr, shape, cpu::kDevMask, 0);  // NOLINT(*)
   }
-
-  CSVIterParam param_;
-  // output instance
-  DataInst out_;
-  // internal instance counter
-  unsigned inst_counter_{0};
-  // at end
-  bool end_{false};
   // dummy label
   mshadow::TensorContainer<cpu, 1, real_t> dummy_label;
-  // label parser
-  size_t label_ptr_{0}, label_size_{0};
-  size_t data_ptr_{0}, data_size_{0};
   std::unique_ptr<dmlc::Parser<uint32_t> > label_parser_;
   std::unique_ptr<dmlc::Parser<uint32_t> > data_parser_;
 };
 
+class CSVIter: public IIterator<DataInst> {
+ public:
+  CSVIter() {}
+  virtual ~CSVIter() {}
+
+  // intialize iterator loads data in
+  virtual void Init(const std::vector<std::pair<std::string, std::string> >& 
kwargs) {
+    param_.InitAllowUnknown(kwargs);
+    if (param_.dtype.has_value() && param_.dtype.value() == mshadow::kInt32) {
+      iterator_.reset(reinterpret_cast<CSVIterBase*>(new CSVIterInt()));
+    } else if (!param_.dtype.has_value() || param_.dtype.value() == 
mshadow::kFloat32) {
 
 Review comment:
   Is this value syntax how optional<DType> works?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to