aboutsummaryrefslogtreecommitdiff
path: root/include/numpy_utils.h
diff options
context:
space:
mode:
authorJames Ward <james.ward@arm.com>2022-08-05 13:48:37 +0100
committerJames Ward <james.ward@arm.com>2022-10-04 13:02:00 +0100
commit485a11d8cb67c8062c632f0987cd31cedbe93d6d (patch)
treec12841ac81114120428418f1c359c3d145610804 /include/numpy_utils.h
parentc92710d7259558fb0cd9e9b38d0c78da21c6e2d4 (diff)
downloadserialization_lib-485a11d8cb67c8062c632f0987cd31cedbe93d6d.tar.gz
FP16 support in serialization
* Allow serialization of fp16 data * Add package to support integrated half data-type (half_float::half), independent of native float: http://half.sourceforge.net/ * Allow passing of accumulate data-type in serialization Signed-off-by: James Ward <james.ward@arm.com> Change-Id: I54357f02e3776d81958228f699ea5044f2014f4b
Diffstat (limited to 'include/numpy_utils.h')
-rw-r--r--include/numpy_utils.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/numpy_utils.h b/include/numpy_utils.h
index c64bc17..6a20eb3 100644
--- a/include/numpy_utils.h
+++ b/include/numpy_utils.h
@@ -24,6 +24,8 @@
#include <cstring>
#include <vector>
+#include "half.hpp"
+
class NumpyUtilities
{
public:
@@ -39,6 +41,8 @@ public:
static NPError readFromNpyFile(const char* filename, const uint32_t elems, float* databuf);
+ static NPError readFromNpyFile(const char* filename, const uint32_t elems, half_float::half* 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);
@@ -49,6 +53,9 @@ public:
static NPError writeToNpyFile(const char* filename, const uint32_t elems, const bool* databuf);
+ static NPError
+ writeToNpyFile(const char* filename, const std::vector<int32_t>& shape, const half_float::half* databuf);
+
static NPError writeToNpyFile(const char* filename, const std::vector<int32_t>& shape, const int32_t* databuf);
static NPError writeToNpyFile(const char* filename, const uint32_t elems, const int32_t* databuf);