Skip to content
Snippets Groups Projects
Commit 8d8d3c4c authored by Cyril Moineau's avatar Cyril Moineau
Browse files

Merge branch 'ExportTensorRegistration' into 'dev'

[fix] Temporary fix for export backend that need to register fake tensor backends.

See merge request !259
parents 301dbec1 833596a1
No related branches found
No related tags found
2 merge requests!279v0.4.0,!259[fix] Temporary fix for export backend that need to register fake tensor backends.
Pipeline #59877 passed
...@@ -5,6 +5,3 @@ import aidge_core ...@@ -5,6 +5,3 @@ import aidge_core
class ExportSerialize(ExportLib): class ExportSerialize(ExportLib):
_name="export_serialize" _name="export_serialize"
aidge_core.register_Tensor(["export_serialize", aidge_core.dtype.float32],
aidge_core.get_key_value_Tensor(["cpu", aidge_core.dtype.float32]))
...@@ -2,6 +2,7 @@ from typing import Dict, List ...@@ -2,6 +2,7 @@ from typing import Dict, List
import aidge_core import aidge_core
from aidge_core.export_utils import ExportNode from aidge_core.export_utils import ExportNode
class classproperty: class classproperty:
"""Helper class to define class-level properties. """Helper class to define class-level properties.
...@@ -50,6 +51,35 @@ class ExportLib(aidge_core.OperatorImpl): ...@@ -50,6 +51,35 @@ class ExportLib(aidge_core.OperatorImpl):
def __init__(self, operator): def __init__(self, operator):
super(ExportLib, self).__init__(operator, self._name) 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 @classproperty
def _export_node_registry(cls) -> Dict[str, List['ExportNode']]: def _export_node_registry(cls) -> Dict[str, List['ExportNode']]:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment