Skip to content
Snippets Groups Projects

Add support for non-defined inputs and outputs of nodes in show_graphview.py.

Merged Iryna de Albuquerque Silva requested to merge idealbuq/aidge_core:dev into dev
+ 28
10
@@ -58,20 +58,36 @@ def _create_dict(ordered_nodes : List[aidge_core.Node], write_trainable_params_e
@@ -58,20 +58,36 @@ def _create_dict(ordered_nodes : List[aidge_core.Node], write_trainable_params_e
'nb_outputs' : node.get_operator().nb_outputs()}
'nb_outputs' : node.get_operator().nb_outputs()}
inputs = []
inputs = []
for input_idx in range(node.get_operator().nb_inputs()):
if node.get_operator().nb_inputs() > 0:
input_dict = {'dims' : node.get_operator().get_input(input_idx).dims(),
for input_idx in range(node.get_operator().nb_inputs()):
'data_type' : str(node.get_operator().get_input(input_idx).dtype()),
if node.get_operator().get_input(input_idx) is not None:
'data_format' : str(node.get_operator().get_input(input_idx).dformat())}
input_dict = {'dims' : node.get_operator().get_input(input_idx).dims(),
inputs.append(input_dict)
'data_type' : str(node.get_operator().get_input(input_idx).dtype()),
 
'data_format' : str(node.get_operator().get_input(input_idx).dformat())}
 
 
elif node.get_operator().get_input(input_idx) is None:
 
input_dict = {'dims' : None,
 
'data_type' : None,
 
'data_format' : None}
 
 
inputs.append(input_dict)
node_dict['inputs'] = inputs
node_dict['inputs'] = inputs
outputs = []
outputs = []
for output_idx in range(node.get_operator().nb_outputs()):
if node.get_operator().nb_outputs() > 0:
output_dict = {'dims' : node.get_operator().get_output(output_idx).dims(),
for output_idx in range(node.get_operator().nb_outputs()):
'data_type' : str(node.get_operator().get_output(output_idx).dtype()),
if node.get_operator().get_output(output_idx) is not None:
'data_format' : str(node.get_operator().get_output(output_idx).dformat())}
output_dict = {'dims' : node.get_operator().get_output(output_idx).dims(),
outputs.append(output_dict)
'data_type' : str(node.get_operator().get_output(output_idx).dtype()),
 
'data_format' : str(node.get_operator().get_output(output_idx).dformat())}
 
 
elif node.get_operator().get_output(output_idx) is None:
 
output_dict = {'dims' : None,
 
'data_type' : None,
 
'data_format' : None}
 
 
outputs.append(output_dict)
node_dict['outputs'] = outputs
node_dict['outputs'] = outputs
@@ -199,6 +215,8 @@ def gview_to_json(gview : aidge_core.GraphView, json_path : Path, write_trainabl
@@ -199,6 +215,8 @@ def gview_to_json(gview : aidge_core.GraphView, json_path : Path, write_trainabl
:type params_file_format: str, optional
:type params_file_format: str, optional
"""
"""
 
json_path = Path(json_path)
 
if not json_path.suffix:
if not json_path.suffix:
if not json_path.is_dir():
if not json_path.is_dir():
json_path.mkdir(parents=True, exist_ok=True)
json_path.mkdir(parents=True, exist_ok=True)
Loading