Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions backends/arm/test/ops/test_exp.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,42 @@ def test_exp_vgf_quant(test_data: Tuple):
quantize=True,
)
pipeline.run()


a16w8_exp_test_parameters = {
"rank1_rand": lambda: torch.rand(10),
"rank2_rand": lambda: torch.rand(8, 8) - 0.5,
"rank3_rand": lambda: torch.rand(1, 4, 4) * 2 - 1,
}


@common.parametrize("test_data", a16w8_exp_test_parameters)
@common.XfailIfNoCorstone300
def test_exp_a16w8_u55_INT(test_data: Tuple):
pipeline = EthosU55PipelineINT[input_t1](
Exp(),
(test_data(),),
aten_op,
exir_ops=[],
symmetric_io_quantization=True,
a16w8_quantization=True,
qtol=128,
epsilon=2**-16,
)
pipeline.run()


@common.parametrize("test_data", a16w8_exp_test_parameters)
@common.XfailIfNoCorstone320
def test_exp_a16w8_u85_INT(test_data: Tuple):
pipeline = EthosU85PipelineINT[input_t1](
Exp(),
(test_data(),),
aten_op,
exir_ops=[],
symmetric_io_quantization=True,
a16w8_quantization=True,
qtol=128,
epsilon=2**-16,
)
pipeline.run()
47 changes: 47 additions & 0 deletions backends/arm/test/ops/test_mean_dim.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,3 +393,50 @@ def test_mean_tosa_INT(test_data):
symmetric_io_quantization=True,
)
pipeline.run()


a16w8_mean_test_parameters = {
"rank_1_keepdim": lambda: (torch.rand(7), 0, True),
"rank_2_keepdim": lambda: (torch.rand(7, 3), (0, 1), True),
"rank_3_keepdim": lambda: (torch.rand(5, 7, 3), (0, 1, 2), True),
"rand_1_keepdim": lambda: (torch.rand(1, 5, 7, 3), (1), True),
"rand_23_keepdim": lambda: (torch.rand(1, 5, 7, 3), (2, 3), True),
"rand_0123_keepdim": lambda: (torch.rand(1, 5, 7, 3), (0, 1, 2, 3), True),
"rand_none_keepdim": lambda: (torch.rand(1, 5, 7, 3), None, True),
"rank_1": lambda: (torch.rand(7), (-1), False),
"rank_2": lambda: (torch.rand(5, 7), (-2, -1), False),
"rand_3": lambda: (torch.rand(1, 5, 7, 3), (-1), False),
"rand_123": lambda: (torch.rand(1, 5, 7, 3), (-3, -2, -1), False),
}


@common.parametrize("test_data", a16w8_mean_test_parameters)
@common.XfailIfNoCorstone300
def test_mean_dim_a16w8_u55_INT(test_data):
test_data, dim, keep_dim = test_data()
pipeline = EthosU55PipelineINT[input_t](
MeanDim(dim, keep_dim),
(test_data,),
[],
symmetric_io_quantization=True,
a16w8_quantization=True,
qtol=128,
epsilon=2**-16,
)
pipeline.run()


@common.parametrize("test_data", a16w8_mean_test_parameters)
@common.XfailIfNoCorstone320
def test_mean_dim_a16w8_u85_INT(test_data):
test_data, dim, keep_dim = test_data()
pipeline = EthosU85PipelineINT[input_t](
MeanDim(dim, keep_dim),
(test_data,),
[],
symmetric_io_quantization=True,
a16w8_quantization=True,
qtol=128,
epsilon=2**-16,
)
pipeline.run()
39 changes: 39 additions & 0 deletions backends/arm/test/ops/test_reciprocal.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,3 +123,42 @@ def test_reciprocal_vgf_quant(test_data: torch.Tensor):
quantize=True,
)
pipeline.run()


a16w8_reciprocal_test_parameters = {
"rank1": lambda: torch.rand(10) + 0.5,
"rank2": lambda: torch.rand(5, 10) + 0.5,
"rank3": lambda: torch.rand(2, 5, 10) + 0.5,
}


@common.parametrize("test_data", a16w8_reciprocal_test_parameters)
@common.XfailIfNoCorstone300
def test_reciprocal_a16w8_u55_INT(test_data: torch.Tensor):
pipeline = EthosU55PipelineINT[input_t1](
Reciprocal(),
(test_data(),),
aten_op,
exir_ops=[],
a16w8_quantization=True,
symmetric_io_quantization=True,
qtol=128,
epsilon=2**-16,
)
pipeline.run()


@common.parametrize("test_data", a16w8_reciprocal_test_parameters)
@common.XfailIfNoCorstone320
def test_reciprocal_a16w8_u85_INT(test_data: torch.Tensor):
pipeline = EthosU85PipelineINT[input_t1](
Reciprocal(),
(test_data(),),
aten_op,
exir_ops=[],
a16w8_quantization=True,
symmetric_io_quantization=True,
qtol=128,
epsilon=2**-16,
)
pipeline.run()
3 changes: 3 additions & 0 deletions backends/arm/test/targets.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ def define_arm_tests():
"ops/test_view.py",
"ops/test_cos.py",
"ops/test_to_copy.py",
"ops/test_exp.py",
"ops/test_reciprocal.py",
"ops/test_mean_dim.py",
]

# Quantization
Expand Down
Loading