diff --git a/aidge_export_arm_cortexm/__init__.py b/aidge_export_arm_cortexm/__init__.py index 7794c236c2565ea9b06a24ba40c9933c3a7641ae..846fe42ddd62d623dd3afadeb08f864d16e460ef 100644 --- a/aidge_export_arm_cortexm/__init__.py +++ b/aidge_export_arm_cortexm/__init__.py @@ -3,7 +3,12 @@ Use this module to generate CPP exports for ARM CortexM boards. This module has to be used with the Aidge suite """ +from pathlib import Path + +FILE = Path(__file__).resolve() +ROOT = FILE.parents[0] from .export import * from .export_registry import ExportLibAidgeARM, ExportLibCMSISNN from .operators import * + diff --git a/aidge_export_arm_cortexm/export.py b/aidge_export_arm_cortexm/export.py index be332bc6043fe853e723382f1df0516934c82bda..95b09b2226962e41b2d7c41cbe0423a628eb9d90 100644 --- a/aidge_export_arm_cortexm/export.py +++ b/aidge_export_arm_cortexm/export.py @@ -1,7 +1,7 @@ import os import shutil from pathlib import Path -from aidge_export_arm_cortexm.utils import (ROOT, AVAILABLE_BOARDS, has_board) +from aidge_export_arm_cortexm import ROOT from aidge_export_arm_cortexm.export_registry import ExportLibAidgeARM # from aidge_export_arm_cortexm.utils.converter import numpy_dtype2ctype @@ -50,7 +50,3 @@ def gen_board_files(path:str, board:str)->None: # Copy all static files in the export shutil.copytree(BOARDS_MAP[board], str(path), dirs_exist_ok=True) - # For N2D2 library, copy static folder to export/include - dnn_include_folder = dnn_folder / "include" - os.makedirs(str(dnn_include_folder), exist_ok=True) - shutil.copytree(str(ROOT / "_N2D2" / "static"), str(dnn_include_folder), dirs_exist_ok=True) diff --git a/aidge_export_arm_cortexm/operators.py b/aidge_export_arm_cortexm/operators.py index 64eb57c5cb6d0780e33d3986b481384b484d4b2e..9f006329d46c27b5a6b8952c4c91eab1e08f27a8 100644 --- a/aidge_export_arm_cortexm/operators.py +++ b/aidge_export_arm_cortexm/operators.py @@ -7,14 +7,30 @@ from typing import Tuple, List import aidge_core from aidge_core.export_utils import ExportNode, ExportNodeCpp from aidge_core.export_utils.code_generation import * -from aidge_export_arm_cortexm.utils import ROOT -from aidge_export_arm_cortexm.utils.converter import numpy_dtype2ctype -from aidge_export_arm_cortexm.utils.generation import * +from aidge_export_arm_cortexm import ROOT from aidge_export_arm_cortexm.export_registry import ExportLibAidgeARM ############################################## ############## Export functions ############## ############################################## +# Note: to remove +def numpy_dtype2ctype(dtype): + if dtype == np.int8: + return "int8_t" + elif dtype == np.int16: + return "int16_t" + elif dtype == np.int32: + return "int32_t" + elif dtype == np.int64: + return "int64_t" + elif dtype == np.float32: + return "float" + elif dtype == np.float64: + return "double" + # Add more dtype mappings as needed + else: + raise ValueError(f"Unsupported {dtype} dtype") + def export_params(name:str, array: np.ndarray,