ONE - On-device Neural Engine
|
Functions | |
one_cmd_list () | |
add_default_arg (parser) | |
add_default_arg_no_CS (parser) | |
is_accumulated_arg (arg, driver) | |
is_valid_attr (args, attr) | |
configparser.ConfigParser | get_config_parser () |
parse_cfg (Union[str, None] config_path, str section_to_parse, args, bool quiet=False) | |
print_version_and_exit (file_path) | |
safemain (main, mainpath) | |
run_ret (cmd, *str one_cmd=None, err_prefix=None, logfile=None) | |
run (cmd, *str one_cmd=None, err_prefix=None, logfile=None) | |
remove_prefix (str, prefix) | |
remove_suffix (str, suffix) | |
get_optimization_list (get_name=False) | |
get_target_list (get_name=False) | |
Optional[ArgumentParser] | get_arg_parser (Optional[str] backend, str cmd, Optional[str] target) |
detect_one_import_drivers (search_path) | |
Variables | |
dict | ONE_CMD |
utils.add_default_arg | ( | parser | ) |
Definition at line 60 of file utils.py.
utils.add_default_arg_no_CS | ( | parser | ) |
This adds -v -V args only (no -C nor -S)
Definition at line 79 of file utils.py.
utils.detect_one_import_drivers | ( | search_path | ) |
Looks for import drivers in given directory Args: search_path: path to the directory where to search import drivers Returns: dict: each entry is related to single detected driver, key is a config section name, value is a driver name
Definition at line 383 of file utils.py.
Optional[ArgumentParser] utils.get_arg_parser | ( | Optional[str] | backend, |
str | cmd, | ||
Optional[str] | target | ||
) |
Definition at line 358 of file utils.py.
configparser.ConfigParser utils.get_config_parser | ( | ) |
Initialize configparser and set default option This funciton has been introduced for all the one-cmds tools having same parsing option.
Definition at line 111 of file utils.py.
Referenced by parse_cfg().
utils.get_optimization_list | ( | get_name = False | ) |
returns a list of optimization. If `get_name` is True, only basename without extension is returned rather than full file path. [one hierarchy] one ├── backends ├── bin ├── doc ├── include ├── lib ├── optimization └── test Optimization options must be placed in `optimization` folder
Definition at line 280 of file utils.py.
References remove_suffix().
utils.get_target_list | ( | get_name = False | ) |
returns a list of targets. If `get_name` is True, only basename without extension is returned rather than full file path. [one hierarchy] one ├── backends ├── bin ├── doc ├── include ├── lib ├── optimization ├── target └── test Target configuration files must be placed in `target` folder
Definition at line 321 of file utils.py.
References remove_suffix().
utils.is_accumulated_arg | ( | arg, | |
driver | |||
) |
Definition at line 96 of file utils.py.
Referenced by parse_cfg().
utils.is_valid_attr | ( | args, | |
attr | |||
) |
Definition at line 107 of file utils.py.
Referenced by parse_cfg().
utils.one_cmd_list | ( | ) |
utils.parse_cfg | ( | Union[str, None] | config_path, |
str | section_to_parse, | ||
args, | |||
bool | quiet = False |
||
) |
parse configuration file and store the information to args :param config_path: path to configuration file :param section_to_parse: section name to parse :param args: object to store the parsed information :param quiet: raise no error when given section doesn't exist
Definition at line 123 of file utils.py.
References get_config_parser(), is_accumulated_arg(), and is_valid_attr().
utils.print_version_and_exit | ( | file_path | ) |
print version of the file located in the file_path
Definition at line 166 of file utils.py.
utils.remove_prefix | ( | str, | |
prefix | |||
) |
utils.remove_suffix | ( | str, | |
suffix | |||
) |
Definition at line 274 of file utils.py.
Referenced by get_optimization_list(), and get_target_list().
utils.run | ( | cmd, | |
*str | one_cmd = None , |
||
err_prefix = None , |
|||
logfile = None |
|||
) |
Execute command in subprocess Args: one_cmd: subtool name to execute with given `cmd` cmd: command to be executed in subprocess err_prefix: prefix to be put before every stderr lines logfile: file stream to which both of stdout and stderr lines will be written
Definition at line 228 of file utils.py.
References one_cmd_list().
utils.run_ret | ( | cmd, | |
*str | one_cmd = None , |
||
err_prefix = None , |
|||
logfile = None |
|||
) |
Execute command in subprocess Args: one_cmd: subtool name to execute with given `cmd` cmd: command to be executed in subprocess err_prefix: prefix to be put before every stderr lines logfile: file stream to which both of stdout and stderr lines will be written Return: Process execution return code; 0 if success and others for error.
Definition at line 186 of file utils.py.
References one_cmd_list().
utils.safemain | ( | main, | |
mainpath | |||
) |
execute given method and print with program name for all uncaught exceptions
Definition at line 176 of file utils.py.
References main().
dict utils.ONE_CMD |