diff options
Diffstat (limited to 'src/mlia/devices/cortexa/advice_generation.py')
-rw-r--r-- | src/mlia/devices/cortexa/advice_generation.py | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/src/mlia/devices/cortexa/advice_generation.py b/src/mlia/devices/cortexa/advice_generation.py index 186f489..3d2f106 100644 --- a/src/mlia/devices/cortexa/advice_generation.py +++ b/src/mlia/devices/cortexa/advice_generation.py @@ -7,9 +7,11 @@ from mlia.core.advice_generation import advice_category from mlia.core.advice_generation import FactBasedAdviceProducer from mlia.core.common import AdviceCategory from mlia.core.common import DataItem +from mlia.devices.cortexa.data_analysis import ModelHasCustomOperators from mlia.devices.cortexa.data_analysis import ModelIsCortexACompatible from mlia.devices.cortexa.data_analysis import ModelIsNotCortexACompatible from mlia.devices.cortexa.data_analysis import ModelIsNotTFLiteCompatible +from mlia.devices.cortexa.data_analysis import TFLiteCompatibilityCheckFailed class CortexAAdviceProducer(FactBasedAdviceProducer): @@ -92,17 +94,25 @@ class CortexAAdviceProducer(FactBasedAdviceProducer): "The following operators are not natively " "supported by TensorFlow Lite: " f"{', '.join(data_item.flex_ops)}.", + "Using select TensorFlow operators in TensorFlow Lite model " + "requires special initialization of TFLiteConverter and " + "TensorFlow Lite run-time.", "Please refer to the TensorFlow documentation for more details.", + "Note, such models are not supported by the ML Inference Advisor.", ] ) if data_item.custom_ops: self.add_advice( [ - "The following operators are custom and not natively " + "The following operators appears to be custom and not natively " "supported by TensorFlow Lite: " f"{', '.join(data_item.custom_ops)}.", + "Using custom operators in TensorFlow Lite model " + "requires special initialization of TFLiteConverter and " + "TensorFlow Lite run-time.", "Please refer to the TensorFlow documentation for more details.", + "Note, such models are not supported by the ML Inference Advisor.", ] ) @@ -113,3 +123,29 @@ class CortexAAdviceProducer(FactBasedAdviceProducer): "Please refer to the table for more details.", ] ) + + @produce_advice.register + @advice_category(AdviceCategory.ALL, AdviceCategory.OPERATORS) + def handle_tflite_check_failed( + self, _data_item: TFLiteCompatibilityCheckFailed + ) -> None: + """Advice for the failed TensorFlow Lite compatibility checks.""" + self.add_advice( + [ + "Model could not be converted into TensorFlow Lite format.", + "Please refer to the table for more details.", + ] + ) + + @produce_advice.register + @advice_category(AdviceCategory.ALL, AdviceCategory.OPERATORS) + def handle_model_has_custom_operators( + self, _data_item: ModelHasCustomOperators + ) -> None: + """Advice for the models with custom operators.""" + self.add_advice( + [ + "Models with custom operators require special initialization " + "and currently are not supported by the ML Inference Advisor.", + ] + ) |