lebeg commented on a change in pull request #9799: Cleaned up image 
classification cpp example
URL: https://github.com/apache/incubator-mxnet/pull/9799#discussion_r168725721
 
 

 ##########
 File path: 
example/image-classification/predict-cpp/image-classification-predict.cc
 ##########
 @@ -32,252 +48,254 @@ const mx_float DEFAULT_MEAN = 117.0;
 // Read file to buffer
 class BufferFile {
  public :
-    std::string file_path_;
-    int length_;
-    char* buffer_;
-
-    explicit BufferFile(std::string file_path)
-    :file_path_(file_path) {
-
-        std::ifstream ifs(file_path.c_str(), std::ios::in | std::ios::binary);
-        if (!ifs) {
-            std::cerr << "Can't open the file. Please check " << file_path << 
". \n";
-            length_ = 0;
-            buffer_ = NULL;
-            return;
-        }
+  std::string file_path_;
+  int length_;
+  char* buffer_;
+
+  explicit BufferFile(std::string file_path)
+    : file_path_(file_path) {
+
+    std::ifstream ifs(file_path.c_str(), std::ios::in | std::ios::binary);
+    if (!ifs) {
+      std::cerr << "Can't open the file. Please check " << file_path << ". \n";
+      length_ = 0;
+      buffer_ = NULL;
+      return;
+    }
 
-        ifs.seekg(0, std::ios::end);
-        length_ = ifs.tellg();
-        ifs.seekg(0, std::ios::beg);
-        std::cout << file_path.c_str() << " ... "<< length_ << " bytes\n";
+    ifs.seekg(0, std::ios::end);
+    length_ = ifs.tellg();
+    ifs.seekg(0, std::ios::beg);
+    std::cout << file_path.c_str() << " ... " << length_ << " bytes\n";
 
-        buffer_ = new char[sizeof(char) * length_];
-        ifs.read(buffer_, length_);
-        ifs.close();
-    }
+    buffer_ = new char[sizeof(char) * length_];
+    ifs.read(buffer_, length_);
+    ifs.close();
+  }
 
-    int GetLength() {
-        return length_;
-    }
-    char* GetBuffer() {
-        return buffer_;
-    }
+  int GetLength() {
+    return length_;
+  }
 
-    ~BufferFile() {
-        if (buffer_) {
-          delete[] buffer_;
-          buffer_ = NULL;
-        }
+  char* GetBuffer() {
+    return buffer_;
+  }
+
+  ~BufferFile() {
+    if (buffer_) {
 
 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