aboutsummaryrefslogtreecommitdiff
path: root/src/mlia/core
diff options
context:
space:
mode:
authorBenjamin Klimczak <benjamin.klimczak@arm.com>2022-06-27 09:10:49 +0100
committerBenjamin Klimczak <benjamin.klimczak@arm.com>2022-06-27 16:18:55 +0100
commit0ee201dfa023a9f42e1c8a282e96c231c6769e07 (patch)
treeabd0048d0f1922470e3fe6befcc32f62d38a52f5 /src/mlia/core
parent7faf2c4763f299ee53b1ed100025ba50021c8313 (diff)
downloadmlia-0ee201dfa023a9f42e1c8a282e96c231c6769e07.tar.gz
MLIA-522 No 'perf' in mode 'all' for TFLite files
Fix the issue that no performance information is shown for TFLite files when the mode 'all_tests' is used. Change-Id: I8b4df4ab84ba9783b582ad449a34bf6177037e14
Diffstat (limited to 'src/mlia/core')
-rw-r--r--src/mlia/core/common.py13
-rw-r--r--src/mlia/core/context.py6
2 files changed, 10 insertions, 9 deletions
diff --git a/src/mlia/core/common.py b/src/mlia/core/common.py
index 5fbad42..a11bf9a 100644
--- a/src/mlia/core/common.py
+++ b/src/mlia/core/common.py
@@ -7,7 +7,8 @@ core module.
"""
from abc import ABC
from abc import abstractmethod
-from enum import Enum
+from enum import auto
+from enum import Flag
from typing import Any
# This type is used as type alias for the items which are being passed around
@@ -17,16 +18,16 @@ from typing import Any
DataItem = Any
-class AdviceCategory(Enum):
+class AdviceCategory(Flag):
"""Advice category.
Enumeration of advice categories supported by ML Inference Advisor.
"""
- OPERATORS = 1
- PERFORMANCE = 2
- OPTIMIZATION = 3
- ALL = 4
+ OPERATORS = auto()
+ PERFORMANCE = auto()
+ OPTIMIZATION = auto()
+ ALL = OPERATORS | PERFORMANCE | OPTIMIZATION
@classmethod
def from_string(cls, value: str) -> "AdviceCategory":
diff --git a/src/mlia/core/context.py b/src/mlia/core/context.py
index 8b3dd2c..83d2f7c 100644
--- a/src/mlia/core/context.py
+++ b/src/mlia/core/context.py
@@ -55,7 +55,7 @@ class Context(ABC):
@property
@abstractmethod
- def advice_category(self) -> Optional[AdviceCategory]:
+ def advice_category(self) -> AdviceCategory:
"""Return advice category."""
@property
@@ -97,7 +97,7 @@ class ExecutionContext(Context):
def __init__(
self,
*,
- advice_category: Optional[AdviceCategory] = None,
+ advice_category: AdviceCategory = AdviceCategory.ALL,
config_parameters: Optional[Mapping[str, Any]] = None,
working_dir: Optional[Union[str, Path]] = None,
event_handlers: Optional[List[EventHandler]] = None,
@@ -141,7 +141,7 @@ class ExecutionContext(Context):
self._action_resolver = action_resolver or APIActionResolver()
@property
- def advice_category(self) -> Optional[AdviceCategory]:
+ def advice_category(self) -> AdviceCategory:
"""Return advice category."""
return self._advice_category