aboutsummaryrefslogtreecommitdiff
path: root/tests/test_devices_cortexa_data_analysis.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_devices_cortexa_data_analysis.py')
-rw-r--r--tests/test_devices_cortexa_data_analysis.py81
1 files changed, 78 insertions, 3 deletions
diff --git a/tests/test_devices_cortexa_data_analysis.py b/tests/test_devices_cortexa_data_analysis.py
index b491e52..4d98212 100644
--- a/tests/test_devices_cortexa_data_analysis.py
+++ b/tests/test_devices_cortexa_data_analysis.py
@@ -11,10 +11,18 @@ from mlia.devices.cortexa.data_analysis import CortexADataAnalyzer
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.operator_compatibility import ARMNN_TFLITE_DELEGATE
from mlia.devices.cortexa.operators import CortexACompatibilityInfo
+from mlia.devices.cortexa.operators import Operator
from mlia.nn.tensorflow.tflite_compat import TFLiteCompatibilityInfo
from mlia.nn.tensorflow.tflite_compat import TFLiteConversionError
from mlia.nn.tensorflow.tflite_compat import TFLiteConversionErrorCode
+from mlia.nn.tensorflow.tflite_graph import TFL_ACTIVATION_FUNCTION
+
+BACKEND_INFO = (
+ f"{ARMNN_TFLITE_DELEGATE['metadata']['backend']} "
+ f"{ARMNN_TFLITE_DELEGATE['metadata']['version']}"
+)
@pytest.mark.parametrize(
@@ -22,11 +30,78 @@ from mlia.nn.tensorflow.tflite_compat import TFLiteConversionErrorCode
[
[
CortexACompatibilityInfo(True, []),
- [ModelIsCortexACompatible()],
+ [ModelIsCortexACompatible(BACKEND_INFO)],
+ ],
+ [
+ CortexACompatibilityInfo(
+ True,
+ [
+ Operator(
+ "CONV_2D",
+ "somewhere",
+ support_type=Operator.SupportType.COMPATIBLE,
+ activation_func=TFL_ACTIVATION_FUNCTION.NONE,
+ ),
+ Operator(
+ "CUSTOM",
+ "somewhere else",
+ support_type=Operator.SupportType.COMPATIBLE,
+ activation_func=TFL_ACTIVATION_FUNCTION.SIGN_BIT,
+ custom_name="MaxPool3D",
+ ),
+ ],
+ ),
+ [ModelIsCortexACompatible(BACKEND_INFO)],
],
[
- CortexACompatibilityInfo(False, []),
- [ModelIsNotCortexACompatible()],
+ # pylint: disable=line-too-long
+ CortexACompatibilityInfo(
+ False,
+ [
+ Operator(
+ "UNSUPPORTED_OP",
+ "somewhere",
+ support_type=Operator.SupportType.OP_NOT_SUPPORTED,
+ activation_func=TFL_ACTIVATION_FUNCTION.NONE,
+ ),
+ Operator(
+ "CUSTOM",
+ "somewhere",
+ support_type=Operator.SupportType.OP_NOT_SUPPORTED,
+ activation_func=TFL_ACTIVATION_FUNCTION.NONE,
+ custom_name="UNSUPPORTED_OP",
+ ),
+ Operator(
+ "CONV_2D",
+ "somewhere else",
+ support_type=Operator.SupportType.ACTIVATION_NOT_SUPPORTED,
+ activation_func=TFL_ACTIVATION_FUNCTION.SIGN_BIT,
+ ),
+ ],
+ ),
+ [
+ ModelIsNotCortexACompatible(
+ BACKEND_INFO,
+ {
+ "UNSUPPORTED_OP",
+ "CUSTOM - 'UNSUPPORTED_OP'",
+ },
+ {
+ "CONV_2D": ModelIsNotCortexACompatible.ActivationFunctionSupport(
+ used_unsupported={TFL_ACTIVATION_FUNCTION.SIGN_BIT.name},
+ supported={
+ "RELU",
+ "RELU6",
+ "RELU_N1_TO_1",
+ "SIGMOID",
+ "TANH",
+ "NONE",
+ },
+ )
+ },
+ )
+ ],
+ # pylint: enable=line-too-long
],
[
TFLiteCompatibilityInfo(compatible=True),