Skip to content
Snippets Groups Projects
Commit 3e705c08 authored by Houssem ROUIS's avatar Houssem ROUIS
Browse files

Merge branch aidge_core:main into sqrt_op

parents acc5d5e2 daec3e64
No related branches found
No related tags found
1 merge request!42add sqrt operator
Pipeline #33931 passed
...@@ -9,6 +9,14 @@ variables: ...@@ -9,6 +9,14 @@ variables:
GIT_SSL_NO_VERIFY: 1 GIT_SSL_NO_VERIFY: 1
DEBIAN_FRONTEND: noninteractive DEBIAN_FRONTEND: noninteractive
# See https://docs.gitlab.com/ee/ci/yaml/workflow.html#switch-between-branch-pipelines-and-merge-request-pipelines
workflow:
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
- if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
when: never
- if: $CI_COMMIT_BRANCH
default: default:
image: nvidia/cuda:12.2.0-devel-ubuntu22.04 image: nvidia/cuda:12.2.0-devel-ubuntu22.04
before_script: before_script:
......
...@@ -8,3 +8,4 @@ http://www.eclipse.org/legal/epl-2.0. ...@@ -8,3 +8,4 @@ http://www.eclipse.org/legal/epl-2.0.
SPDX-License-Identifier: EPL-2.0 SPDX-License-Identifier: EPL-2.0
""" """
from aidge_core.aidge_core import * # import so generated by PyBind from aidge_core.aidge_core import * # import so generated by PyBind
from aidge_core.export import ExportNode
from .node_export import *
import aidge_core
from abc import ABC, abstractmethod
class ExportNode(ABC):
"""Abstract class to interface node with export generation.
"""
@abstractmethod
def __init__(self, aidge_node: aidge_core.Node) -> None:
"""Create ExportNode and retieve attirubtes from ``aidge_node``:
- name: aidge Node name
- attributes: dictionnary of attributes of the aidge Operator linked to the node, attributes name follow aidge naming convention
- parameters: List of parameters node, order in the list is the same as the one defined by the aidge operator
"""
super().__init__()
self.node = aidge_node
self.operator = aidge_node.get_operator()
self.name = self.node.name()
self.attributes = {} # Attributes are auto fetched from aidge operators
if isinstance(self.operator, aidge_core.Attributes):
for attr_name in self.operator.get_attrs_name():
self.attributes[attr_name] = self.operator.get_attr(attr_name)
# rename is_leaf ?
self.is_last = len(self.node.get_children()) == 0
self.inputs = []
self.outputs = []
self.inputs_dims = []
self.outputs_dims = []
for idx, parent_node in enumerate(self.node.get_parents()):
self.inputs.append(parent_node)
if parent_node is not None:
self.inputs_dims.append(self.operator.input(idx).dims())
else:
self.inputs_dims.append(None)
for idx, child_node in enumerate(self.node.get_children()):
self.outputs.append(child_node)
# Dirty hot fix, change it quickly
self.outputs_dims.append(self.operator.output(0).dims())
@abstractmethod
def export(self, export_folder:str, list_configs:list):
"""Define how to export the node definition.
"""
pass
@abstractmethod
def forward(self, list_actions:list):
"""Define how to generate code to perform a forward pass.
"""
pass
...@@ -27,7 +27,7 @@ void init_GenericOperator(py::module& m) { ...@@ -27,7 +27,7 @@ void init_GenericOperator(py::module& m) {
.def("compute_output_dims", &GenericOperator_Op::computeOutputDims) .def("compute_output_dims", &GenericOperator_Op::computeOutputDims)
.def("set_compute_output_dims", &GenericOperator_Op::setComputeOutputDims, py::arg("computation_function")); .def("set_compute_output_dims", &GenericOperator_Op::setComputeOutputDims, py::arg("computation_function"));
m.def("GenericOperator", &GenericOperator, py::arg("type"), py::arg("nbDataIn"), py::arg("nbIn"), py::arg("nbOut"), m.def("GenericOperator", &GenericOperator, py::arg("type"), py::arg("nb_data_in"), py::arg("nb_in"), py::arg("nb_out"),
py::arg("name") = ""); py::arg("name") = "");
} }
} // namespace Aidge } // namespace Aidge
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