diff options
author | Jerry Ge <jerry.ge@arm.com> | 2023-07-03 16:36:41 +0000 |
---|---|---|
committer | Jerry Ge <jerry.ge@arm.com> | 2023-07-05 20:09:41 +0000 |
commit | 13a329156f5ae51a0ffffcb0083d807da9e5b19f (patch) | |
tree | 90dd3dad7eb256a16905d7b55433ab6505e4015b /include | |
parent | 3acb1cbfdd492ab4f657799ed0c2279a5e390248 (diff) | |
download | serialization_lib-13a329156f5ae51a0ffffcb0083d807da9e5b19f.tar.gz |
Support reading anydtype into a 32-bit buffer
Signed-off-by: Jerry Ge <jerry.ge@arm.com>
Change-Id: Ic6b43539fcb2d75c5614d3addccd24a06e9f2a31
Diffstat (limited to 'include')
-rw-r--r-- | include/numpy_utils.h | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/include/numpy_utils.h b/include/numpy_utils.h index 29d7e11..e9c4bb4 100644 --- a/include/numpy_utils.h +++ b/include/numpy_utils.h @@ -1,5 +1,5 @@ -// Copyright (c) 2020-2021, ARM Limited. +// Copyright (c) 2020-2023, ARM Limited. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -37,6 +37,7 @@ public: FILE_TYPE_MISMATCH, HEADER_PARSE_ERROR, BUFFER_SIZE_MISMATCH, + DATA_TYPE_NOT_SUPPORTED, }; static NPError readFromNpyFile(const char* filename, const uint32_t elems, float* databuf); @@ -45,14 +46,6 @@ public: static NPError readFromNpyFile(const char* filename, const uint32_t elems, half_float::half* databuf); - static NPError readFromNpyFile(const char* filename, const uint32_t elems, uint8_t* databuf); - - static NPError readFromNpyFile(const char* filename, const uint32_t elems, int8_t* databuf); - - static NPError readFromNpyFile(const char* filename, const uint32_t elems, uint16_t* databuf); - - static NPError readFromNpyFile(const char* filename, const uint32_t elems, int16_t* databuf); - static NPError readFromNpyFile(const char* filename, const uint32_t elems, int32_t* databuf); static NPError readFromNpyFile(const char* filename, const uint32_t elems, int64_t* databuf); @@ -112,6 +105,7 @@ private: void* databuf, bool bool_translate); static NPError checkNpyHeader(FILE* infile, const uint32_t elems, const char* dtype_str); + static NPError getHeader(FILE* infile, bool& is_signed, int& bit_length, char& byte_order); static NPError writeNpyHeader(FILE* outfile, const std::vector<int32_t>& shape, const char* dtype_str); }; |