You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2018/03/25 02:50:03 UTC

[GitHub] cjolivier01 commented on a change in pull request #10234: [MXNET-135] mx.image.imread support s3

cjolivier01 commented on a change in pull request #10234: [MXNET-135] mx.image.imread support s3
URL: https://github.com/apache/incubator-mxnet/pull/10234#discussion_r176927115
 
 

 ##########
 File path: src/io/image_io.cc
 ##########
 @@ -217,17 +217,28 @@ void Imread(const nnvm::NodeAttrs& attrs,
             std::vector<NDArray>* outputs) {
 #if MXNET_USE_OPENCV
   const auto& param = nnvm::get<ImreadParam>(attrs.parsed);
-
-  std::ifstream file(param.filename, std::ios::binary | std::ios::ate);
-  // if file is not open we get bad alloc after tellg
-  CHECK(file.is_open()) << "Imread: '" << param.filename
-      << "' couldn't open file: " << strerror(errno);
-  size_t fsize = file.tellg();
-  file.seekg(0, std::ios::beg);
+  dmlc::Stream *fi = dmlc::Stream::Create(param.filename.c_str(), "r", true);
+  CHECK(fi != NULL) << "Imread: '" << param.filename
+    << "' couldn't open file: " << strerror(errno);
+  std::vector<char*> buff_vec;
+  std::vector<int> buff_size;
+  int ptr = 0, single_buff_size = 10000;
 
 Review comment:
   ptr you could declare in bottom for loop:
   for(int i = 0, ptr = 0; ...
   also ptr is kind of misleading, it’s more like an offset, right?
   

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services