Skip to content

Commit 66ad21c

Browse files
Cortex_M backend: Remove scalar-scalar tests (#16078)
Removes scalar-scalar tests for mul and add as scalars are treated as constants, and are pre-computed ahead-of-time, hence making it pointless in testing them in isolation. Signed-off-by: Oscar Andersson <oscar.andersson@arm.com>
1 parent b23fcbd commit 66ad21c

File tree

2 files changed

+5
-36
lines changed

2 files changed

+5
-36
lines changed

backends/cortex_m/test/ops/test_add.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,6 @@ class CortexMAlphaAdd(ModelAlpha):
7474

7575

7676
test_cases = {
77-
"self_scalar": McuTestCase(
78-
CortexMSelfAdd(),
79-
(10.0,),
80-
),
8177
"self_rank_1": McuTestCase(
8278
CortexMSelfAdd(),
8379
(torch.linspace(-5, 5, 10),),
@@ -98,10 +94,6 @@ class CortexMAlphaAdd(ModelAlpha):
9894
CortexMSelfAdd(),
9995
(ramp_tensor(-5, 5, (2, 2, 2, 2, 2)),),
10096
),
101-
"scalar_scalar": McuTestCase(
102-
CortexMScalarAdd(),
103-
(-0.5, 1.0),
104-
),
10597
"tensor_scalar": McuTestCase(
10698
CortexMScalarAdd(),
10799
(torch.ones(1), 1.1),
@@ -140,14 +132,6 @@ class CortexMAlphaAdd(ModelAlpha):
140132

141133

142134
xfails_implementation = {
143-
"self_scalar": (
144-
"'float' object has not attribute 'fake_mode' - scalar only ops not supported.",
145-
AttributeError,
146-
),
147-
"scalar_scalar": (
148-
"'float' object has not attribute 'fake_mode' - scalar only ops not supported.",
149-
AttributeError,
150-
),
151135
"alpha": (
152136
"Expecting kwargs for aten op IR to be empty - alpha arg not supported.",
153137
AssertionError,

backends/cortex_m/test/ops/test_mul.py

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,6 @@ class CortexMTensorMul(Model):
6060

6161

6262
test_cases = {
63-
"self_scalar": McuTestCase(
64-
CortexMSelfMul(),
65-
(10.0,),
66-
),
6763
"self_rank_1": McuTestCase(
6864
CortexMSelfMul(),
6965
(ramp_tensor(-5, 5, (10,)),),
@@ -84,10 +80,6 @@ class CortexMTensorMul(Model):
8480
CortexMSelfMul(),
8581
(ramp_tensor(-5, 5, (2, 2, 2, 2, 2)),),
8682
),
87-
"scalar_scalar": McuTestCase(
88-
CortexMScalarMul(),
89-
(-0.5, 1.0),
90-
),
9183
"tensor_scalar": McuTestCase(
9284
CortexMScalarMul(),
9385
(torch.ones(1), 1.0),
@@ -114,17 +106,7 @@ class CortexMTensorMul(Model):
114106
}
115107

116108

117-
xfail_cases_implementation = {
118-
"self_scalar": (
119-
"'float' object has not attribute 'fake_mode' - scalar only ops not supported.",
120-
AttributeError,
121-
),
122-
"scalar_scalar": (
123-
"'float' object has not attribute 'fake_mode' - scalar only ops not supported.",
124-
AttributeError,
125-
),
126-
}
127-
xfail_cases_dialect = xfail_cases_implementation | {
109+
xfail_cases_dialect = {
128110
# Cortex-M quantizer will not quantize multiplicaitons that require broadcasting
129111
# leading to the mul op not being replaced by a cortex-m specific implementation
130112
"broadcast_1": "Broadcasting is not supported in Cortex-M backend",
@@ -143,7 +125,10 @@ def test_dialect_mul(test_case):
143125
)
144126

145127

146-
@parametrize("test_case", test_cases, xfails=xfail_cases_implementation)
128+
@parametrize(
129+
"test_case",
130+
test_cases,
131+
)
147132
def test_implementation_mul(test_case):
148133
tester = CortexMTester(test_case.model, test_case.example_inputs)
149134
tester.test_implementation(qtol=1)

0 commit comments

Comments
 (0)