diff options
author | Benjamin Klimczak <benjamin.klimczak@arm.com> | 2023-02-08 16:00:34 +0000 |
---|---|---|
committer | Benjamin Klimczak <benjamin.klimczak@arm.com> | 2023-02-10 13:45:18 +0000 |
commit | fa1fad9332e2912f12a44a1b07716ee434174308 (patch) | |
tree | 246dfdb4ec9c495faaa55d73e061bcb4f8171d98 /src/mlia/cli | |
parent | 7a661257b6adad0c8f53e32b42ced56a1e7d952f (diff) | |
download | mlia-fa1fad9332e2912f12a44a1b07716ee434174308.tar.gz |
MLIA-769 Replace use of 'device' with 'target'
Term 'device' can be ambiguous and is replaced with 'target'.
Change-Id: I5e5108d033a13b98e4c2997713e1c32bce63ae62
Diffstat (limited to 'src/mlia/cli')
-rw-r--r-- | src/mlia/cli/commands.py | 2 | ||||
-rw-r--r-- | src/mlia/cli/helpers.py | 30 | ||||
-rw-r--r-- | src/mlia/cli/options.py | 8 |
3 files changed, 20 insertions, 20 deletions
diff --git a/src/mlia/cli/commands.py b/src/mlia/cli/commands.py index 27f5b2b..f0ba519 100644 --- a/src/mlia/cli/commands.py +++ b/src/mlia/cli/commands.py @@ -48,7 +48,7 @@ def check( comprehensive report/advice: - converts the input Keras model into TensorFlow Lite format - - checks the model for operator compatibility on the specified device + - checks the model for operator compatibility on the specified target - generates a final report on the steps above - provides advice on how to (possibly) improve the inference performance diff --git a/src/mlia/cli/helpers.py b/src/mlia/cli/helpers.py index 576670b..abc6df0 100644 --- a/src/mlia/cli/helpers.py +++ b/src/mlia/cli/helpers.py @@ -42,7 +42,7 @@ class CLIActionResolver(ActionResolver): @staticmethod def _specific_optimization_command( model_path: str, - device_opts: str, + target_opts: str, opt_settings: list[OptimizationSettings], ) -> list[str]: """Return specific optimization command description.""" @@ -56,43 +56,43 @@ class CLIActionResolver(ActionResolver): return [ "For more info: mlia optimize --help", "Optimization command: " - f"mlia optimize {model_path}{device_opts} {opt_types} {opt_targs}", + f"mlia optimize {model_path}{target_opts} {opt_types} {opt_targs}", ] def apply_optimizations(self, **kwargs: Any) -> list[str]: """Return command details for applying optimizations.""" - model_path, device_opts = self._get_model_and_device_opts() + model_path, target_opts = self._get_model_and_target_opts() if (opt_settings := kwargs.pop("opt_settings", None)) is None: return self._general_optimization_command(model_path) if is_list_of(opt_settings, OptimizationSettings) and model_path: return self._specific_optimization_command( - model_path, device_opts, opt_settings + model_path, target_opts, opt_settings ) return [] def check_performance(self) -> list[str]: """Return command details for checking performance.""" - model_path, device_opts = self._get_model_and_device_opts() + model_path, target_opts = self._get_model_and_target_opts() if not model_path: return [] return [ "Check the estimated performance by running the following command: ", - f"mlia check {model_path}{device_opts} --performance", + f"mlia check {model_path}{target_opts} --performance", ] def check_operator_compatibility(self) -> list[str]: """Return command details for op compatibility.""" - model_path, device_opts = self._get_model_and_device_opts() + model_path, target_opts = self._get_model_and_target_opts() if not model_path: return [] return [ "Try running the following command to verify that:", - f"mlia check {model_path}{device_opts}", + f"mlia check {model_path}{target_opts}", ] def operator_compatibility_details(self) -> list[str]: @@ -103,16 +103,16 @@ class CLIActionResolver(ActionResolver): """Return command details for optimization.""" return ["For more info, see: mlia optimize --help"] - def _get_model_and_device_opts( - self, separate_device_opts: bool = True + def _get_model_and_target_opts( + self, separate_target_opts: bool = True ) -> tuple[str | None, str]: - """Get model and device options.""" - device_opts = " ".join(get_target_profile_opts(self.args)) - if separate_device_opts and device_opts: - device_opts = f" {device_opts}" + """Get model and target options.""" + target_opts = " ".join(get_target_profile_opts(self.args)) + if separate_target_opts and target_opts: + target_opts = f" {target_opts}" model_path = self.args.get("model") - return model_path, device_opts + return model_path, target_opts def copy_profile_file_to_output_dir( diff --git a/src/mlia/cli/options.py b/src/mlia/cli/options.py index 8cd2935..b16f77f 100644 --- a/src/mlia/cli/options.py +++ b/src/mlia/cli/options.py @@ -282,9 +282,9 @@ def parse_optimization_parameters( return optimizer_params -def get_target_profile_opts(device_args: dict | None) -> list[str]: +def get_target_profile_opts(target_args: dict | None) -> list[str]: """Get non default values passed as parameters for the target profile.""" - if not device_args: + if not target_args: return [] parser = argparse.ArgumentParser() @@ -298,7 +298,7 @@ def get_target_profile_opts(device_args: dict | None) -> list[str]: non_default = [ arg_name - for arg_name, arg_value in device_args.items() + for arg_name, arg_value in target_args.items() if arg_name in args and vars(args)[arg_name] != arg_value ] @@ -312,7 +312,7 @@ def get_target_profile_opts(device_args: dict | None) -> list[str]: return [ item for name in non_default - for item in construct_param(params_name[name], device_args[name]) + for item in construct_param(params_name[name], target_args[name]) ] |