Skip to content

Commit 343128e

Browse files
Add a16w8 per-op test for exp
Summary: Add int16 activation / int8 weight (a16w8) quantization tests for `aten.exp` on Ethos-U55 and Ethos-U85. ## Changes - Add `a16w8_exp_test_parameters` dict with 3 test configurations covering rank-1, rank-2, and rank-3 tensors - Add `test_exp_a16w8_u55_INT` using `EthosU55PipelineINT` with `a16w8_quantization=True, symmetric_io_quantization=True, qtol=128, epsilon=2**-16` - Add `test_exp_a16w8_u85_INT` using `EthosU85PipelineINT` with same kwargs - Register `ops/test_exp.py` in `fbcode/` and `xplat/` `targets.bzl` bypass-pytorch-oss-checks Differential Revision: D104532358
1 parent 12c1195 commit 343128e

2 files changed

Lines changed: 40 additions & 0 deletions

File tree

backends/arm/test/ops/test_exp.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,3 +129,42 @@ def test_exp_vgf_quant(test_data: Tuple):
129129
quantize=True,
130130
)
131131
pipeline.run()
132+
133+
134+
a16w8_exp_test_parameters = {
135+
"rank1_rand": lambda: torch.rand(10),
136+
"rank2_rand": lambda: torch.rand(8, 8) - 0.5,
137+
"rank3_rand": lambda: torch.rand(1, 4, 4) * 2 - 1,
138+
}
139+
140+
141+
@common.parametrize("test_data", a16w8_exp_test_parameters)
142+
@common.XfailIfNoCorstone300
143+
def test_exp_a16w8_u55_INT(test_data: Tuple):
144+
pipeline = EthosU55PipelineINT[input_t1](
145+
Exp(),
146+
(test_data(),),
147+
aten_op,
148+
exir_ops=[],
149+
symmetric_io_quantization=True,
150+
a16w8_quantization=True,
151+
qtol=128,
152+
epsilon=2**-16,
153+
)
154+
pipeline.run()
155+
156+
157+
@common.parametrize("test_data", a16w8_exp_test_parameters)
158+
@common.XfailIfNoCorstone320
159+
def test_exp_a16w8_u85_INT(test_data: Tuple):
160+
pipeline = EthosU85PipelineINT[input_t1](
161+
Exp(),
162+
(test_data(),),
163+
aten_op,
164+
exir_ops=[],
165+
symmetric_io_quantization=True,
166+
a16w8_quantization=True,
167+
qtol=128,
168+
epsilon=2**-16,
169+
)
170+
pipeline.run()

backends/arm/test/targets.bzl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ def define_arm_tests():
3636
"ops/test_view.py",
3737
"ops/test_cos.py",
3838
"ops/test_to_copy.py",
39+
"ops/test_exp.py",
3940
]
4041

4142
# Quantization

0 commit comments

Comments
 (0)