cjolivier01 commented on a change in pull request #9883: added function for loading content of nd_array files URL: https://github.com/apache/incubator-mxnet/pull/9883#discussion_r170460309
########## File path: src/c_api/c_api.cc ########## @@ -322,6 +322,38 @@ int MXNDArrayLoad(const char* fname, API_END(); } +int MXNDArrayLoadFileContent(const void *nd_file, + size_t size, + mx_uint *out_size, + NDArrayHandle** out_arr, + mx_uint *out_name_size, + const char*** out_names) { + MXAPIThreadLocalEntry *ret = MXAPIThreadLocalStore::Get(); + ret->ret_vec_str.clear(); + API_BEGIN(); + std::vector<NDArray> data; + std::vector<std::string> &names = ret->ret_vec_str; + { + std::unique_ptr<dmlc::MemoryFixedSizeStream> fi(new dmlc::MemoryFixedSizeStream((void*)nd_file, size)); // NOLINT(*) + mxnet::NDArray::Load(fi.get(), &data, &names); Review comment: what happens if there is an error/formatting problem? from the python perspective? how catastrophic is that? ---------------------------------------------------------------- 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