diff --git a/aidge_core/aidge_export_aidge/operator_export/sub.py b/aidge_core/aidge_export_aidge/operator_export/sub.py new file mode 100644 index 0000000000000000000000000000000000000000..efcdd0924fbcf6944b0fb95a967e1a3e16ccc3c5 --- /dev/null +++ b/aidge_core/aidge_export_aidge/operator_export/sub.py @@ -0,0 +1,21 @@ +from aidge_core.aidge_export_aidge.utils import operator_register, parse_node_input +from aidge_core import ExportNode, generate_str +from aidge_core.aidge_export_aidge import ROOT_EXPORT +from pathlib import Path + +@operator_register("Sub") +class Sub(ExportNode): + def __init__(self, node): + super().__init__(node) + + def export(self, export_folder:Path, list_configs:list): + return list_configs + + def forward(self, list_actions:list): + list_actions.append(generate_str( + ROOT_EXPORT / "templates/graph_ctor/sub.jinja", + name=self.name, + inputs=parse_node_input(self.node.inputs()), + **self.attributes + )) + return list_actions diff --git a/aidge_core/aidge_export_aidge/templates/graph_ctor/sub.jinja b/aidge_core/aidge_export_aidge/templates/graph_ctor/sub.jinja new file mode 100644 index 0000000000000000000000000000000000000000..d9417751e4117cb296ec874d946b93c2c64df614 --- /dev/null +++ b/aidge_core/aidge_export_aidge/templates/graph_ctor/sub.jinja @@ -0,0 +1,9 @@ +{% filter indent(width=4, first=False) %} +/*** {{name|upper}} ***/ +std::shared_ptr<Aidge::Node> {{name}} = + Aidge::Sub( + "{{name}}" + ); +{% include "./_set_input.jinja" %} +graph->add({{name}}); +{% endfilter %}