diff --git a/aidge_core/aidge_export_aidge/registry.py b/aidge_core/aidge_export_aidge/registry.py index fe94a22399438b9a07673d21220ff1d0ba4a1dda..cfed0822ff2d8351af60cd211c190a802fe4a674 100644 --- a/aidge_core/aidge_export_aidge/registry.py +++ b/aidge_core/aidge_export_aidge/registry.py @@ -5,6 +5,3 @@ import aidge_core class ExportSerialize(ExportLib): _name="export_serialize" - -aidge_core.register_Tensor(["export_serialize", aidge_core.dtype.float32], - aidge_core.get_key_value_Tensor(["cpu", aidge_core.dtype.float32])) diff --git a/aidge_core/export_utils/export_registry.py b/aidge_core/export_utils/export_registry.py index 989ccd367f7b85a50c974aa110036c7aa4eda404..e5b6b2098cd760c4d425b96caf7b41cc8e82c46e 100644 --- a/aidge_core/export_utils/export_registry.py +++ b/aidge_core/export_utils/export_registry.py @@ -2,6 +2,7 @@ from typing import Dict, List import aidge_core from aidge_core.export_utils import ExportNode + class classproperty: """Helper class to define class-level properties. @@ -50,6 +51,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']]: