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

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

parent 301dbec1
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 #59847 canceled
......@@ -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']]:
......
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