From a01e0e1229e30f9e2ebf3cd921ffe0dbef1cbea9 Mon Sep 17 00:00:00 2001 From: Dmitrii Agibov Date: Wed, 15 Feb 2023 14:58:37 +0000 Subject: MLIA-812 Show error message for unsupported functionality Change-Id: I68fb8c4e51046e9fc2d91ad8338718ba545209cd --- src/mlia/target/cortex_a/advisor.py | 10 ++++++++++ src/mlia/target/ethos_u/advisor.py | 4 ++-- src/mlia/target/tosa/advisor.py | 8 ++++++++ 3 files changed, 20 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mlia/target/cortex_a/advisor.py b/src/mlia/target/cortex_a/advisor.py index 5c077fb..3c127ec 100644 --- a/src/mlia/target/cortex_a/advisor.py +++ b/src/mlia/target/cortex_a/advisor.py @@ -44,6 +44,16 @@ class CortexAInferenceAdvisor(DefaultInferenceAdvisor): if context.category_enabled(AdviceCategory.COMPATIBILITY): collectors.append(CortexAOperatorCompatibility(model, target_config)) + if context.category_enabled(AdviceCategory.PERFORMANCE): + raise Exception( + "Performance estimation is currently not supported for Cortex-A." + ) + + if context.category_enabled(AdviceCategory.OPTIMIZATION): + raise Exception( + "Model optimizations are currently not supported for Cortex-A." + ) + return collectors def get_analyzers(self, context: Context) -> list[DataAnalyzer]: diff --git a/src/mlia/target/ethos_u/advisor.py b/src/mlia/target/ethos_u/advisor.py index 0eec6aa..714d6a4 100644 --- a/src/mlia/target/ethos_u/advisor.py +++ b/src/mlia/target/ethos_u/advisor.py @@ -53,9 +53,9 @@ class EthosUInferenceAdvisor(DefaultInferenceAdvisor): # Decide which one to use (taking into account the model format). if is_tflite_model(model): # TensorFlow Lite models do not support optimization (only performance)! - if context.advice_category == AdviceCategory.OPTIMIZATION: + if context.category_enabled(AdviceCategory.OPTIMIZATION): raise Exception( - "Command 'optimization' is not supported for TensorFlow Lite files." + "Optimizations are not supported for TensorFlow Lite files." ) if context.category_enabled(AdviceCategory.PERFORMANCE): collectors.append(EthosUPerformance(model, target_config, backends)) diff --git a/src/mlia/target/tosa/advisor.py b/src/mlia/target/tosa/advisor.py index 7666df4..7859eca 100644 --- a/src/mlia/target/tosa/advisor.py +++ b/src/mlia/target/tosa/advisor.py @@ -43,6 +43,14 @@ class TOSAInferenceAdvisor(DefaultInferenceAdvisor): if context.category_enabled(AdviceCategory.COMPATIBILITY): collectors.append(TOSAOperatorCompatibility(model)) + if context.category_enabled(AdviceCategory.PERFORMANCE): + raise Exception( + "Performance estimation is currently not supported for TOSA." + ) + + if context.category_enabled(AdviceCategory.OPTIMIZATION): + raise Exception("Model optimizations are currently not supported for TOSA.") + return collectors def get_analyzers(self, context: Context) -> list[DataAnalyzer]: -- cgit v1.2.1