Skip to content

Commit 1890848

Browse files
mcr229facebook-github-bot
authored andcommitted
Test
Differential Revision: D49850152 fbshipit-source-id: 16b649befbf0a7393dad66b01b8111fb460b8458
1 parent dc5b1e0 commit 1890848

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

backends/xnnpack/test/TARGETS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ python_unittest(
126126
"models/*.py",
127127
]),
128128
deps = [
129+
"fbsource//third-party/pypi/torchsr:torchsr", # @manual
129130
"//caffe2:torch",
130131
"//executorch/backends/xnnpack/partition:xnnpack_partitioner",
131132
"//executorch/backends/xnnpack/test/tester:tester",

backends/xnnpack/test/models/edsr.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Copyright (c) Meta Platforms, Inc. and affiliates.
2+
# All rights reserved.
3+
#
4+
# This source code is licensed under the BSD-style license found in the
5+
# LICENSE file in the root directory of this source tree.
6+
7+
import unittest
8+
9+
import torch
10+
11+
from executorch.backends.xnnpack.test.tester import Tester
12+
from torchsr.models import edsr_r16f64
13+
14+
15+
class TestEDSR(unittest.TestCase):
16+
edsr = edsr_r16f64(2, False).eval() # noqa
17+
model_inputs = (torch.ones(1, 3, 224, 224),)
18+
19+
def test_fp32_edsr(self):
20+
(
21+
Tester(self.edsr, self.model_inputs)
22+
.export()
23+
.to_edge()
24+
.partition()
25+
.to_executorch()
26+
.serialize()
27+
.run_method()
28+
.compare_outputs()
29+
)
30+
31+
def test_qs8_edsr(self):
32+
(
33+
Tester(self.edsr, self.model_inputs)
34+
.quantize()
35+
.export()
36+
.to_edge()
37+
.partition()
38+
.to_executorch()
39+
.serialize()
40+
.run_method()
41+
.compare_outputs()
42+
)

0 commit comments

Comments
 (0)