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

Adapt Producer operator.

parent 10371533
No related branches found
No related tags found
No related merge requests found
import os
import shutil
import numpy as np
from pathlib import Path
from jinja2 import Environment, FileSystemLoader
from aidge_core.export_utils import ExportNode, ExportNodeCpp, operator_register, generate_str, generate_file
from aidge_core.export_utils import ExportNode, ExportNodeCpp, operator_register, generate_file
from aidge_export_cpp.utils import ROOT
from aidge_export_cpp.utils.converter import numpy_dtype2ctype
from aidge_export_cpp.utils.generation import *
......@@ -68,19 +66,17 @@ class ProducerCPP(ExportNode):
if len(self.values.shape) == 4: # Note: export in HWC
self.values = np.transpose(self.values, (0, 2, 3, 1))
def export(self, export_folder: Path, list_configs: list):
list_configs.append(f"include/parameters/{self.attributes['name']}.h")
def export(self, export_folder: Path):
header_path = f"include/parameters/{self.attributes['name']}.h"
export_params(
self.attributes['out_name'][0],
self.values.reshape(-1),
str(export_folder / "include" / "parameters" / f"{self.attributes['name']}.h"))
return list_configs
str(export_folder / header_path))
return [header_path]
def forward(self, list_actions: list):
def forward(self):
# A Producer does nothing during forward
return list_actions
return []
@classmethod
def exportable(cls, node):
return True # TODO add check i/o NCHW
......
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