Skip to content
Snippets Groups Projects
Commit afd7a672 authored by Axel Farrugia's avatar Axel Farrugia
Browse files

[Fix](Exports) labels are now generted once and optional inputs are ignored

parent b31c583a
No related branches found
No related tags found
3 merge requests!414Update version 0.5.1 -> 0.6.0,!408[Add] Dropout Operator,!369[Feat](Exports) Minor features for export generation
......@@ -32,30 +32,35 @@ def generate_main_cpp(export_folder: str, graph_view: aidge_core.GraphView, inpu
gv_inputs: list[tuple[aidge_core.Node, int]] = graph_view.get_ordered_inputs()
gv_outputs: list[tuple[aidge_core.Node, int]] = graph_view.get_ordered_outputs()
# Generate input file(s)
for in_node, in_idx in gv_inputs:
in_node_input, in_node_input_idx = in_node.input(in_idx)
in_name = f"{in_node.name()}_input_{in_idx}" if in_node_input is None else f"{in_node_input.name()}_output_{in_node_input_idx}"
inputs_name.append(in_name)
input_tensor = in_node.get_operator().get_input(in_idx)
if input_tensor is None or input_tensor.undefined() or not input_tensor.has_impl():
if inputs_tensor is not None:
aidge_core.Log.notice("No support for inputs_tensor argument yet.")
aidge_core.Log.notice(f"No input tensor set for {in_name}, main generated will not be functionnal after code generation.")
else:
aidge_core.Log.notice(f"No input tensor set for {in_name}, main generated will not be functionnal after code generation.")
# if input_tensor is None or input_tensor.undefined() or not input_tensor.has_impl():
# if inputs_tensor is not None:
# aidge_core.Log.notice("No support for inputs_tensor argument yet.")
# aidge_core.Log.notice(f"No input tensor set for {in_name}, main generated will not be functionnal after code generation.")
# else:
# aidge_core.Log.notice(f"No input tensor set for {in_name}, main generated will not be functionnal after code generation.")
# Ignore optional inputs
if in_node.get_operator().input_category(in_idx) == aidge_core.InputCategory(2):
aidge_core.Log.notice(f"Ignoring optional input {in_name}.")
else:
# Generate input file
inputs_name.append(in_name)
generate_input_file(
export_folder=str(Path(export_folder) / "data"),
array_name=in_name,
tensor=input_tensor)
if labels is not None:
# Generate labels
generate_input_file(
export_folder=str(Path(export_folder) / "data"),
array_name="labels",
tensor=labels
)
# Generate labels file
if labels is not None:
generate_input_file(
export_folder=str(Path(export_folder) / "data"),
array_name="labels",
tensor=labels
)
for out_node, out_id in gv_outputs:
outputs_name.append(f"{out_node.name()}_output_{out_id}")
......
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