diff --git a/aidge_core/export_utils/export_registry.py b/aidge_core/export_utils/export_registry.py index 989ccd367f7b85a50c974aa110036c7aa4eda404..c0719d0320500700b0d234c22d8a21f96ee82def 100644 --- a/aidge_core/export_utils/export_registry.py +++ b/aidge_core/export_utils/export_registry.py @@ -2,6 +2,9 @@ from typing import Dict, List import aidge_core from aidge_core.export_utils import ExportNode +# import aidge_core +# + class classproperty: """Helper class to define class-level properties. @@ -50,6 +53,35 @@ class ExportLib(aidge_core.OperatorImpl): def __init__(self, operator): super(ExportLib, self).__init__(operator, self._name) + if self._name is None: + raise ValueError("ExportLib {self.__class__.__name__} does not define the attribute ``_name``.") + + # TODO: This is a patch, setBackend method is used to set an ExportLib as an Implementation. + # But it also set the backend of the Tensor and we don't define a backend for Tensor. + # The following code block associate to the export backend the "cpu" implementation. + # This is tracked by the issue : + # https://gitlab.eclipse.org/eclipse/aidge/aidge_core/-/issues/178 + + aidge_core.register_Tensor([self._name, aidge_core.dtype.float32], + aidge_core.get_key_value_Tensor(["cpu", aidge_core.dtype.float32])) + aidge_core.register_Tensor([self._name, aidge_core.dtype.float16], + aidge_core.get_key_value_Tensor(["cpu", aidge_core.dtype.float16])) + aidge_core.register_Tensor([self._name, aidge_core.dtype.int8], + aidge_core.get_key_value_Tensor(["cpu", aidge_core.dtype.int8])) + aidge_core.register_Tensor([self._name, aidge_core.dtype.int16], + aidge_core.get_key_value_Tensor(["cpu", aidge_core.dtype.int16])) + aidge_core.register_Tensor([self._name, aidge_core.dtype.int32], + aidge_core.get_key_value_Tensor(["cpu", aidge_core.dtype.int32])) + aidge_core.register_Tensor([self._name, aidge_core.dtype.int64], + aidge_core.get_key_value_Tensor(["cpu", aidge_core.dtype.int64])) + aidge_core.register_Tensor([self._name, aidge_core.dtype.uint8], + aidge_core.get_key_value_Tensor(["cpu", aidge_core.dtype.uint8])) + aidge_core.register_Tensor([self._name, aidge_core.dtype.uint16], + aidge_core.get_key_value_Tensor(["cpu", aidge_core.dtype.uint16])) + aidge_core.register_Tensor([self._name, aidge_core.dtype.uint32], + aidge_core.get_key_value_Tensor(["cpu", aidge_core.dtype.uint32])) + aidge_core.register_Tensor([self._name, aidge_core.dtype.uint64], + aidge_core.get_key_value_Tensor(["cpu", aidge_core.dtype.uint64])) @classproperty def _export_node_registry(cls) -> Dict[str, List['ExportNode']]: