diff --git a/aidge_core/show_graphview.py b/aidge_core/show_graphview.py index 3d00d576ae1f4b4bbd1bd1b4bb966eed3c2a9764..94669110abc8554a2d30f1f095e9696826c7446c 100644 --- a/aidge_core/show_graphview.py +++ b/aidge_core/show_graphview.py @@ -24,20 +24,20 @@ def _retrieve_operator_attrs(node : aidge_core.Node) -> dict[str, int, float, bo return node_attr_dict -def _create_dict(ordered_nodes : list[aidge_core.Node], write_trainable_params_ext : bool, write_trainable_params_embed : bool, params_file_format : str, path_trainable_params : str) -> dict[str, int, float, bool, None]: +def _create_dict(ordered_nodes : list[aidge_core.Node], write_trainable_params_embed : bool, write_trainable_params_ext : bool, path_trainable_params : str, params_file_format : str) -> dict[str, int, float, bool, None]: """ Creates a dictionary to store the information of a given ordered GraphView. :param ordered_nodes: A list with the GraphView's ordered nodes. :type graph: list - :param write_trainable_params_ext: Whether or not to write the eventual trainable parameters of the Nodes in an external file. - :type write_trainable_params_ext: bool :param write_trainable_params_embed: Whether or not to write the eventual trainable parameters of the Nodes in the same file as the dict (embed). :type write_trainable_params_embed: bool - :param params_file_format: Format of the external file used to store the Nodes' trainable parameters. Options: ``npz`` or ``json``. - :type params_file_format: str + :param write_trainable_params_ext: Whether or not to write the eventual trainable parameters of the Nodes in an external file. + :type write_trainable_params_ext: bool :param path_trainable_params: Path of the external file used to store the Nodes' trainable parameters. :type path_trainable_params: str + :param params_file_format: Format of the external file used to store the Nodes' trainable parameters. Options: ``npz`` or ``json``. + :type params_file_format: str :return: A dictionary with the GraphView description. :rtype: dict[str, int, float, bool, None] @@ -168,7 +168,7 @@ def _write_dict_json(graphview_dict : dict[str, int, float, bool, None], json_pa return None -def gview_to_json(gview : aidge_core.GraphView, json_path : str, write_trainable_params_ext : bool = False, write_trainable_params_embed : bool = False, params_file_format : str = None) -> None: +def gview_to_json(gview : aidge_core.GraphView, json_path : str, write_trainable_params_embed : bool = False, write_trainable_params_ext : bool = False, params_file_format : str = 'json') -> None: """ Generates the description for a GraphView in the JSON format. @@ -176,11 +176,11 @@ def gview_to_json(gview : aidge_core.GraphView, json_path : str, write_trainable :type graph: aidge_core.GraphView :param json_path: Path to write JSON file. :type json_path: str - :param write_trainable_params_ext: Whether or not to write the eventual trainable parameters of the Nodes in an external file. - :type write_trainable_params_ext: bool, optional :param write_trainable_params_embed: Whether or not to write the eventual trainable parameters of the Nodes in the same file as the dict (embed). :type write_trainable_params_embed: bool, optional - :param params_file_format: Format of the external file used to store the Nodes' trainable parameters. Options: ``npz`` or ``json``. Default = ``json``. Requires ``write_trainable_params_ext``. + :param write_trainable_params_ext: Whether or not to write the eventual trainable parameters of the Nodes in an external file. + :type write_trainable_params_ext: bool, optional + :param params_file_format: Format of the external file used to store the Nodes' trainable parameters. Options: ``npz`` or ``json``. Default : ``json``. Requires ``write_trainable_params_ext``. :type params_file_format: str, optional """ @@ -197,7 +197,7 @@ def gview_to_json(gview : aidge_core.GraphView, json_path : str, write_trainable ordered_nodes = gview.get_ordered_nodes() # Create dict from GraphView - graphview_dict = _create_dict(ordered_nodes, write_trainable_params_ext, write_trainable_params_embed, params_file_format, path_trainable_params) + graphview_dict = _create_dict(ordered_nodes, write_trainable_params_embed, write_trainable_params_ext, path_trainable_params, params_file_format) # Write dict to JSON _write_dict_json(graphview_dict, json_path)