diff options
author | Won Jeon <won.jeon@arm.com> | 2024-04-29 23:57:27 +0000 |
---|---|---|
committer | Won Jeon <won.jeon@arm.com> | 2024-05-03 13:33:29 +0000 |
commit | a814152b68a286f5bb9ddc095bb1897ec0e3d8ff (patch) | |
tree | c8aa9a42e3d9fdf978e5d366a301b1f8d9716d83 /include/numpy_utils.h | |
parent | 3aebe2bd863d6e0cb82171984cd49e5ad516d0db (diff) | |
download | serialization_lib-a814152b68a286f5bb9ddc095bb1897ec0e3d8ff.tar.gz |
Use native size of Bfloat16 and Float8 for serialization/deserialization
Signed-off-by: Won Jeon <won.jeon@arm.com>
Change-Id: I0d2075f90988d4fd1139a11b5c154bdd600bb2cd
Diffstat (limited to 'include/numpy_utils.h')
-rw-r--r-- | include/numpy_utils.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/include/numpy_utils.h b/include/numpy_utils.h index 60cf77e..ade2f2d 100644 --- a/include/numpy_utils.h +++ b/include/numpy_utils.h @@ -24,8 +24,13 @@ #include <cstring> #include <vector> +#include "cfloat.h" #include "half.hpp" +using bf16 = ct::cfloat<int16_t, 8, true, true, true>; +using fp8e4m3 = ct::cfloat<int8_t, 4, true, true, false>; +using fp8e5m2 = ct::cfloat<int8_t, 5, true, true, true>; + class NumpyUtilities { public: @@ -85,6 +90,18 @@ public: { return "'<f2'"; } + if (std::is_same<T, bf16>::value) + { + return "'<V2'"; + } + if (std::is_same<T, fp8e4m3>::value) + { + return "'<V1'"; + } + if (std::is_same<T, fp8e5m2>::value) + { + return "'<f1'"; + } assert(false && "unsupported Dtype"); }; |