MCPcopy Create free account
hub / github.com/NVIDIA/FasterTransformer / load_the_npy_file

Function load_the_npy_file

examples/cpp/xlnet/cnpy.cpp:201–213  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

199}
200
201cnpy::NpyArray load_the_npy_file(FILE* fp)
202{
203 std::vector<size_t> shape;
204 size_t word_size;
205 bool fortran_order;
206 cnpy::parse_npy_header(fp, word_size, shape, fortran_order);
207
208 cnpy::NpyArray arr(shape, word_size, fortran_order);
209 size_t nread = fread(arr.data<char>(), 1, arr.num_bytes(), fp);
210 if (nread != arr.num_bytes())
211 throw std::runtime_error("load_the_npy_file: failed fread");
212 return arr;
213}
214
215cnpy::NpyArray load_the_npz_array(FILE* fp, uint32_t compr_bytes, uint32_t uncompr_bytes)
216{

Callers 2

npz_loadMethod · 0.85
npy_loadMethod · 0.85

Calls 1

num_bytesMethod · 0.80

Tested by

no test coverage detected