MLBEDSW-3148: Refactor Operation
- op.type is now an enum instead of a string
- Removed unused operator codes
- Refactored some attributes like npu_block_type, fused_activation_function
- Refactored operator index calculation
- Refactored a number of operator sets
Change-Id: I641f65ee375794b7aec42abc0664251ae37d78e8
Signed-off-by: Louis Verhaard <louis.verhaard@arm.com>
diff --git a/ethosu/vela/test/test_tflite_reader.py b/ethosu/vela/test/test_tflite_reader.py
index d63c000..23abb4a 100644
--- a/ethosu/vela/test/test_tflite_reader.py
+++ b/ethosu/vela/test/test_tflite_reader.py
@@ -20,6 +20,7 @@
import pytest
+from ethosu.vela.operation import Op
from ethosu.vela.tflite_reader import TFLiteSubgraph
@@ -41,13 +42,13 @@
parse_op_testdata = [
# op_type, opt_serializer, inputs, output, expected
- ("FullyConnected", None, [0, 1, 2], 3, 3), # FC
- ("FullyConnected", None, [0, 1, -1], 3, 3), # FC disabled Bias
- ("FullyConnected", None, [0, 1], 3, 3), # FC no Bias
- ("Conv2D", None, [2, 1, 3], 0, 3), # Conv2D
- ("Conv2DBackprop", None, [0, 1, 2, 3], 4, 4), # TransposeConv
- ("Conv2DBackprop", None, [0, 1, 2], 4, 4), # TransposeConv no Bias
- pytest.param("Conv2D", None, [0, -1, 1], 3, 3, marks=pytest.mark.xfail), # Conv2D no Weights
+ (Op.FullyConnected, None, [0, 1, 2], 3, 3), # FC
+ (Op.FullyConnected, None, [0, 1, -1], 3, 3), # FC disabled Bias
+ (Op.FullyConnected, None, [0, 1], 3, 3), # FC no Bias
+ (Op.Conv2D, None, [2, 1, 3], 0, 3), # Conv2D
+ (Op.Conv2DBackpropInput, None, [0, 1, 2, 3], 4, 4), # TransposeConv
+ (Op.Conv2DBackpropInput, None, [0, 1, 2], 4, 4), # TransposeConv no Bias
+ pytest.param(Op.Conv2D, None, [0, -1, 1], 3, 3, marks=pytest.mark.xfail), # Conv2D no Weights
]
@pytest.mark.parametrize("op_type, opt_serializer, inputs, output, expected", parse_op_testdata)
@@ -56,7 +57,7 @@
# Mock a TFLiteSubGraph
sg = TFLiteSubgraph(None, None)
sg.graph = MagicMock()
- sg.graph.operator_codes = [(op_type, opt_serializer)]
+ sg.graph.operator_codes = [(op_type, opt_serializer, "")]
# Mock a couple of tensors
sg.tensors = [MagicMock() for _ in range(5)]