From 485a11d8cb67c8062c632f0987cd31cedbe93d6d Mon Sep 17 00:00:00 2001 From: James Ward Date: Fri, 5 Aug 2022 13:48:37 +0100 Subject: 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 Change-Id: I54357f02e3776d81958228f699ea5044f2014f4b --- include/numpy_utils.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'include/numpy_utils.h') 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 #include +#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& shape, const half_float::half* databuf); + static NPError writeToNpyFile(const char* filename, const std::vector& shape, const int32_t* databuf); static NPError writeToNpyFile(const char* filename, const uint32_t elems, const int32_t* databuf); -- cgit v1.2.1