aboutsummaryrefslogtreecommitdiff
path: root/src/mlia/cli/commands.py
diff options
context:
space:
mode:
authorDmitrii Agibov <dmitrii.agibov@arm.com>2022-09-08 14:24:39 +0100
committerDmitrii Agibov <dmitrii.agibov@arm.com>2022-09-09 17:21:48 +0100
commitf5b293d0927506c2a979a091bf0d07ecc78fa181 (patch)
tree4de585b7cb6ed34da8237063752270189a730a41 /src/mlia/cli/commands.py
parentcde0c6ee140bd108849bff40467d8f18ffc332ef (diff)
downloadmlia-f5b293d0927506c2a979a091bf0d07ecc78fa181.tar.gz
MLIA-386 Simplify typing in the source code
- Enable deferred annotations evaluation - Use builtin types for type hints whenever possible - Use | syntax for union types - Rename mlia.core._typing into mlia.core.typing Change-Id: I3f6ffc02fa069c589bdd9e8bddbccd504285427a
Diffstat (limited to 'src/mlia/cli/commands.py')
-rw-r--r--src/mlia/cli/commands.py26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/mlia/cli/commands.py b/src/mlia/cli/commands.py
index 45c7c32..5dd39f9 100644
--- a/src/mlia/cli/commands.py
+++ b/src/mlia/cli/commands.py
@@ -16,11 +16,11 @@ be configured. Function 'setup_logging' from module
>>> mlia.all_tests(ExecutionContext(working_dir="mlia_output"), "ethos-u55-256",
"path/to/model")
"""
+from __future__ import annotations
+
import logging
from pathlib import Path
from typing import cast
-from typing import List
-from typing import Optional
from mlia.api import ExecutionContext
from mlia.api import get_advice
@@ -42,8 +42,8 @@ def all_tests(
model: str,
optimization_type: str = "pruning,clustering",
optimization_target: str = "0.5,32",
- output: Optional[PathOrFileLike] = None,
- evaluate_on: Optional[List[str]] = None,
+ output: PathOrFileLike | None = None,
+ evaluate_on: list[str] | None = None,
) -> None:
"""Generate a full report on the input model.
@@ -99,8 +99,8 @@ def all_tests(
def operators(
ctx: ExecutionContext,
target_profile: str,
- model: Optional[str] = None,
- output: Optional[PathOrFileLike] = None,
+ model: str | None = None,
+ output: PathOrFileLike | None = None,
supported_ops_report: bool = False,
) -> None:
"""Print the model's operator list.
@@ -149,8 +149,8 @@ def performance(
ctx: ExecutionContext,
target_profile: str,
model: str,
- output: Optional[PathOrFileLike] = None,
- evaluate_on: Optional[List[str]] = None,
+ output: PathOrFileLike | None = None,
+ evaluate_on: list[str] | None = None,
) -> None:
"""Print the model's performance stats.
@@ -192,9 +192,9 @@ def optimization(
model: str,
optimization_type: str,
optimization_target: str,
- layers_to_optimize: Optional[List[str]] = None,
- output: Optional[PathOrFileLike] = None,
- evaluate_on: Optional[List[str]] = None,
+ layers_to_optimize: list[str] | None = None,
+ output: PathOrFileLike | None = None,
+ evaluate_on: list[str] | None = None,
) -> None:
"""Show the performance improvements (if any) after applying the optimizations.
@@ -245,9 +245,9 @@ def optimization(
def backend(
backend_action: str,
- path: Optional[Path] = None,
+ path: Path | None = None,
download: bool = False,
- name: Optional[str] = None,
+ name: str | None = None,
i_agree_to_the_contained_eula: bool = False,
noninteractive: bool = False,
) -> None: