|
| 1 | +# Copyright 2025 Arm Limited and/or its affiliates. |
| 2 | + |
| 3 | +# This source code is licensed under the BSD-style license found in the |
| 4 | +# LICENSE file in the root directory of this source tree. |
| 5 | + |
| 6 | +import unittest |
| 7 | + |
| 8 | +import pytest |
| 9 | + |
| 10 | +from executorch.backends.arm.test import common, conftest |
| 11 | + |
| 12 | +from executorch.backends.arm.test.tester.arm_tester import ArmTester |
| 13 | +from executorch.examples.models import deeplab_v3 |
| 14 | + |
| 15 | + |
| 16 | +class TestDl3(unittest.TestCase): |
| 17 | + """Tests DeepLabv3.""" |
| 18 | + |
| 19 | + dl3 = deeplab_v3.DeepLabV3ResNet50Model() |
| 20 | + model_inputs = dl3.get_example_inputs() |
| 21 | + dl3 = dl3.get_eager_model() |
| 22 | + |
| 23 | + @unittest.expectedFailure |
| 24 | + def test_dl3_tosa_MI(self): |
| 25 | + ( |
| 26 | + ArmTester( |
| 27 | + self.dl3, |
| 28 | + example_inputs=self.model_inputs, |
| 29 | + compile_spec=common.get_tosa_compile_spec("TOSA-0.80+MI"), |
| 30 | + ) |
| 31 | + .export() |
| 32 | + .to_edge_transform_and_lower() |
| 33 | + .to_executorch() |
| 34 | + .run_method_and_compare_outputs(self.model_inputs) |
| 35 | + ) |
| 36 | + |
| 37 | + @unittest.expectedFailure |
| 38 | + def test_dl3_tosa_BI(self): |
| 39 | + ( |
| 40 | + ArmTester( |
| 41 | + self.dl3, |
| 42 | + example_inputs=self.model_inputs, |
| 43 | + compile_spec=common.get_tosa_compile_spec("TOSA-0.80+BI"), |
| 44 | + ) |
| 45 | + .quantize() |
| 46 | + .export() |
| 47 | + .to_edge_transform_and_lower() |
| 48 | + .to_executorch() |
| 49 | + .run_method_and_compare_outputs(atol=1.0, qtol=1, inputs=self.model_inputs) |
| 50 | + ) |
| 51 | + |
| 52 | + @pytest.mark.slow |
| 53 | + @pytest.mark.corstone_fvp |
| 54 | + @unittest.skip |
| 55 | + def test_dl3_u55_BI(self): |
| 56 | + tester = ( |
| 57 | + ArmTester( |
| 58 | + self.dl3, |
| 59 | + example_inputs=self.model_inputs, |
| 60 | + compile_spec=common.get_u55_compile_spec(), |
| 61 | + ) |
| 62 | + .quantize() |
| 63 | + .export() |
| 64 | + .to_edge_transform_and_lower() |
| 65 | + .to_executorch() |
| 66 | + .serialize() |
| 67 | + ) |
| 68 | + if conftest.is_option_enabled("corstone_fvp"): |
| 69 | + tester.run_method_and_compare_outputs( |
| 70 | + atol=1.0, qtol=1, inputs=self.model_inputs |
| 71 | + ) |
| 72 | + |
| 73 | + @pytest.mark.slow |
| 74 | + @pytest.mark.corstone_fvp |
| 75 | + @unittest.skip |
| 76 | + def test_dl3_u85_BI(self): |
| 77 | + tester = ( |
| 78 | + ArmTester( |
| 79 | + self.dl3, |
| 80 | + example_inputs=self.model_inputs, |
| 81 | + compile_spec=common.get_u85_compile_spec(), |
| 82 | + ) |
| 83 | + .quantize() |
| 84 | + .export() |
| 85 | + .to_edge_transform_and_lower() |
| 86 | + .to_executorch() |
| 87 | + .serialize() |
| 88 | + ) |
| 89 | + if conftest.is_option_enabled("corstone_fvp"): |
| 90 | + tester.run_method_and_compare_outputs( |
| 91 | + atol=1.0, qtol=1, inputs=self.model_inputs |
| 92 | + ) |
0 commit comments