haojin2 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_r181259524
 
 

 ##########
 File path: src/io/iter_csv.cc
 ##########
 @@ -88,6 +154,34 @@ class CSVIter: public IIterator<DataInst> {
     end_ = false;
   }
 
+ private:
+  inline TBlob AsTBlob(const dmlc::Row<uint32_t, int>& row, const TShape& 
shape) {
+    CHECK_EQ(row.length, shape.Size())
+        << "The data size in CSV do not match size of shape: "
+        << "specified shape=" << shape << ", the csv row-length=" << 
row.length;
+    const int* ptr = row.value;
+    return TBlob((int*)ptr, shape, cpu::kDevMask, 0);  // NOLINT(*)
+  }
+  // dummy label
+  mshadow::TensorContainer<cpu, 1, int> dummy_label;
+  std::unique_ptr<dmlc::Parser<uint32_t, int> > label_parser_;
+  std::unique_ptr<dmlc::Parser<uint32_t, int> > data_parser_;
+};
+
+class CSVIterFloat: public CSVIterBase {
+ public:
+  virtual ~CSVIterFloat() {}
+  virtual void Init(const std::vector<std::pair<std::string, std::string> >& 
kwargs) {
+    param_.InitAllowUnknown(kwargs);
+    data_parser_.reset(dmlc::Parser<uint32_t>::Create(param_.data_csv.c_str(), 
0, 1, "csv"));
 
 Review comment:
   Done

----------------------------------------------------------------
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