Skip to content

Commit d0fc064

Browse files
Add more models for E2E test
Add more models for E2E test(edsr, inception v3/v4, mobilenet v3, resnet 18/50) Co-authored-by: Jonghun Cha <[email protected]>
1 parent 23898b0 commit d0fc064

File tree

6 files changed

+199
-0
lines changed

6 files changed

+199
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Copyright (c) Samsung Electronics Co. LTD
2+
# All rights reserved
3+
#
4+
# Licensed under the BSD License (the "License"); you may not use this file
5+
# except in compliance with the License. See the license file in the root
6+
# directory of this source tree for more details.
7+
8+
9+
import unittest
10+
11+
import torch
12+
13+
from executorch.backends.samsung.serialization.compile_options import (
14+
gen_samsung_backend_compile_spec,
15+
)
16+
from executorch.backends.samsung.test.tester import SamsungTester
17+
from executorch.examples.models.edsr import EdsrModel
18+
19+
20+
class Test_Milestone_Edsr(unittest.TestCase):
21+
def test_edsr_fp16(self):
22+
model = EdsrModel().get_eager_model()
23+
example_input = EdsrModel().get_example_inputs()
24+
25+
(
26+
SamsungTester(model,
27+
example_input,
28+
[gen_samsung_backend_compile_spec("E9955")],)
29+
.export()
30+
.to_edge_transform_and_lower()
31+
.to_executorch()
32+
.run_method_and_compare_outputs(atol=0.02, rtol=0.02)
33+
)
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Copyright (c) Samsung Electronics Co. LTD
2+
# All rights reserved
3+
#
4+
# Licensed under the BSD License (the "License"); you may not use this file
5+
# except in compliance with the License. See the license file in the root
6+
# directory of this source tree for more details.
7+
8+
9+
import unittest
10+
11+
import torch
12+
13+
from executorch.backends.samsung.serialization.compile_options import (
14+
gen_samsung_backend_compile_spec,
15+
)
16+
from executorch.backends.samsung.test.tester import SamsungTester
17+
from executorch.examples.models.inception_v3 import InceptionV3Model
18+
19+
20+
class Test_Inception_V3(unittest.TestCase):
21+
def test_inception_v3_fp16(self):
22+
model = InceptionV3Model().get_eager_model()
23+
example_input = InceptionV3Model().get_example_inputs()
24+
25+
(
26+
SamsungTester(model,
27+
example_input,
28+
[gen_samsung_backend_compile_spec("E9955")],)
29+
.export()
30+
.to_edge_transform_and_lower()
31+
.to_executorch()
32+
.run_method_and_compare_outputs(atol=0.02, rtol=0.02)
33+
)
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Copyright (c) Samsung Electronics Co. LTD
2+
# All rights reserved
3+
#
4+
# Licensed under the BSD License (the "License"); you may not use this file
5+
# except in compliance with the License. See the license file in the root
6+
# directory of this source tree for more details.
7+
8+
9+
import unittest
10+
11+
import torch
12+
13+
from executorch.backends.samsung.serialization.compile_options import (
14+
gen_samsung_backend_compile_spec,
15+
)
16+
from executorch.backends.samsung.test.tester import SamsungTester
17+
from executorch.examples.models.inception_v4 import InceptionV4Model
18+
19+
20+
class Test_Milestone_InceptionV4(unittest.TestCase):
21+
def test_inception_v4_fp16(self):
22+
model = InceptionV4Model().get_eager_model()
23+
example_input = InceptionV4Model().get_example_inputs()
24+
25+
(
26+
SamsungTester(model,
27+
example_input,
28+
[gen_samsung_backend_compile_spec("E9955")],)
29+
.export()
30+
.to_edge_transform_and_lower()
31+
.to_executorch()
32+
.run_method_and_compare_outputs(atol=0.02, rtol=0.02)
33+
)
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Copyright (c) Samsung Electronics Co. LTD
2+
# All rights reserved
3+
#
4+
# Licensed under the BSD License (the "License"); you may not use this file
5+
# except in compliance with the License. See the license file in the root
6+
# directory of this source tree for more details.
7+
8+
9+
import unittest
10+
11+
import torch
12+
13+
from executorch.backends.samsung.serialization.compile_options import (
14+
gen_samsung_backend_compile_spec,
15+
)
16+
from executorch.backends.samsung.test.tester import SamsungTester
17+
from executorch.examples.models.mobilenet_v3 import MV3Model
18+
19+
20+
class Test_Milestone_MobilenetV3(unittest.TestCase):
21+
def test_mv3_fp16(self):
22+
model = MV3Model().get_eager_model()
23+
example_input = MV3Model().get_example_inputs()
24+
25+
(
26+
SamsungTester(model,
27+
example_input,
28+
[gen_samsung_backend_compile_spec("E9955")],)
29+
.export()
30+
.to_edge_transform_and_lower()
31+
.to_executorch()
32+
.run_method_and_compare_outputs(atol=0.06, rtol=0.06)
33+
# TODO: theshold value should be updated after fixing accuracy issue
34+
)
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Copyright (c) Samsung Electronics Co. LTD
2+
# All rights reserved
3+
#
4+
# Licensed under the BSD License (the "License"); you may not use this file
5+
# except in compliance with the License. See the license file in the root
6+
# directory of this source tree for more details.
7+
8+
9+
import unittest
10+
11+
import torch
12+
13+
from executorch.backends.samsung.serialization.compile_options import (
14+
gen_samsung_backend_compile_spec,
15+
)
16+
from executorch.backends.samsung.test.tester import SamsungTester
17+
from executorch.examples.models.resnet import ResNet18Model
18+
19+
20+
class Test_Milestone_ResNet18(unittest.TestCase):
21+
def test_resnet18_fp16(self):
22+
model = ResNet18Model().get_eager_model()
23+
example_input = ResNet18Model().get_example_inputs()
24+
25+
(
26+
SamsungTester(model,
27+
example_input,
28+
[gen_samsung_backend_compile_spec("E9955")],)
29+
.export()
30+
.to_edge_transform_and_lower()
31+
.to_executorch()
32+
.run_method_and_compare_outputs(atol=0.02, rtol=0.02)
33+
)
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Copyright (c) Samsung Electronics Co. LTD
2+
# All rights reserved
3+
#
4+
# Licensed under the BSD License (the "License"); you may not use this file
5+
# except in compliance with the License. See the license file in the root
6+
# directory of this source tree for more details.
7+
8+
9+
import unittest
10+
11+
import torch
12+
13+
from executorch.backends.samsung.serialization.compile_options import (
14+
gen_samsung_backend_compile_spec,
15+
)
16+
from executorch.backends.samsung.test.tester import SamsungTester
17+
from executorch.examples.models.resnet import ResNet50Model
18+
19+
20+
class Test_Milestone_ResNet50(unittest.TestCase):
21+
def test_resnet50_fp16(self):
22+
model = ResNet50Model().get_eager_model()
23+
example_input = ResNet50Model().get_example_inputs()
24+
25+
(
26+
SamsungTester(model,
27+
example_input,
28+
[gen_samsung_backend_compile_spec("E9955")],)
29+
.export()
30+
.to_edge_transform_and_lower()
31+
.to_executorch()
32+
.run_method_and_compare_outputs(atol=0.02, rtol=0.02)
33+
)

0 commit comments

Comments
 (0)