From e890a41c90c560b5244ba0ce9b988e4f62f84561 Mon Sep 17 00:00:00 2001 From: cmoineau <cyril.moineau@cea.fr> Date: Wed, 13 Nov 2024 09:19:09 +0000 Subject: [PATCH] [Fix] Issue when exporting a network with no input. --- aidge_core/export_utils/scheduler_export.py | 6 +++++- aidge_core/export_utils/templates/main.jinja | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/aidge_core/export_utils/scheduler_export.py b/aidge_core/export_utils/scheduler_export.py index e7b426b7c..b39512b19 100644 --- a/aidge_core/export_utils/scheduler_export.py +++ b/aidge_core/export_utils/scheduler_export.py @@ -157,7 +157,11 @@ def scheduler_export(scheduler, export_folder_path: str, export_lib: ExportLib = func_name=func_name, headers=set(list_configs), actions=list_actions, - mem_ctype=inputs_dtype[0], # Legacy behavior ... + # Note: Graph may not have inputs, so we need to check with output + # In the future, we should remove this has it is not compatible + # with a mix precision approach. + mem_ctype=outputs_dtype[0], # Legacy behavior ... + mem_section=export_lib.mem_section, peak_mem=peak_mem, inputs_name=inputs_name, inputs_dtype=inputs_dtype, diff --git a/aidge_core/export_utils/templates/main.jinja b/aidge_core/export_utils/templates/main.jinja index d0c22719a..697a97b53 100644 --- a/aidge_core/export_utils/templates/main.jinja +++ b/aidge_core/export_utils/templates/main.jinja @@ -26,7 +26,7 @@ int main() {% endfor %} // Call the forward function - {{ func_name }}({{ inputs_name|join(", ") }}, &{{ outputs_name|join(", &") }}); + {{ func_name }}({{ inputs_name|join(", ") }}{% if inputs_name %}, {% endif %}&{{ outputs_name|join(", &") }}); // Print the results of each output {%- for o in range(outputs_name | length) %} -- GitLab