From f7f2394a48639a487078ac05691edf7975a48616 Mon Sep 17 00:00:00 2001 From: thibault allenet <thibault.allenet@cea.fr> Date: Fri, 13 Dec 2024 15:17:58 +0000 Subject: [PATCH] Add data conversion map for low bit datatypes --- aidge_export_arm_cortexm/data_conversion.py | 42 +++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 aidge_export_arm_cortexm/data_conversion.py diff --git a/aidge_export_arm_cortexm/data_conversion.py b/aidge_export_arm_cortexm/data_conversion.py new file mode 100644 index 0000000..8450df0 --- /dev/null +++ b/aidge_export_arm_cortexm/data_conversion.py @@ -0,0 +1,42 @@ +import aidge_core + +from typing import Dict + +datatype_converter_aidge2arm: Dict[aidge_core.dtype, str] = { + aidge_core.dtype.float64 : "data<-64>", + aidge_core.dtype.float32 : "data<-32>", + + aidge_core.dtype.int32 : "data<32>", + aidge_core.dtype.int16 : "data<16>", + aidge_core.dtype.int8 : "data<8>", + aidge_core.dtype.uint32 : "udata<32>", + aidge_core.dtype.uint16 : "udata<16>", + aidge_core.dtype.uint8 : "udata<8>", + + # Integer type without weightinterleaving + # aidge_core.dtype.int7 : "data<8>", + # aidge_core.dtype.int6 : "data<8>", + # aidge_core.dtype.int5 : "data<8>", + aidge_core.dtype.int4 : "data<8>", + aidge_core.dtype.int3 : "data<8>", + aidge_core.dtype.int2 : "data<8>", + aidge_core.dtype.binary : "data<8>", + + # aidge_core.dtype.uint7 : "udata<8>", + # aidge_core.dtype.uint6 : "udata<8>", + # aidge_core.dtype.uint5 : "udata<8>", + aidge_core.dtype.uint4 : "udata<8>", + aidge_core.dtype.uint3 : "udata<8>", + aidge_core.dtype.uint2 : "udata<8>", + + # Integer type with weightinterleaving + aidge_core.dtype.dual_int4 : "data<4>", + aidge_core.dtype.dual_int3 : "data<3>", + aidge_core.dtype.quad_int2 : "data<2>", + aidge_core.dtype.octo_binary : "data<1>", + + aidge_core.dtype.dual_uint4 : "udata<4>", + aidge_core.dtype.dual_uint3 : "udata<3>", + aidge_core.dtype.quad_uint2 : "udata<2>", +} + -- GitLab