Skip to content

Commit 921120f

Browse files
mcr229facebook-github-bot
authored andcommitted
Test (#575)
Summary: Pull Request resolved: #575 Adding a model test for EDSR both for quantized and fp32 Reviewed By: digantdesai, jerryzh168 Differential Revision: D49850152 fbshipit-source-id: 9f31bc4806f76d74f24378c30dcb36372de9ffd3
1 parent 54ddab9 commit 921120f

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
@@ -127,6 +127,7 @@ python_unittest(
127127
]),
128128
tags = ["long_running"],
129129
deps = [
130+
"fbsource//third-party/pypi/torchsr:torchsr", # @manual
130131
"//caffe2:torch",
131132
"//executorch/backends/xnnpack/test/tester:tester",
132133
"//pytorch/vision:torchvision",

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)