Skip to content

Commit fa1e867

Browse files
authored
Align MLPerf Tiny models with reference inference graphs (pytorch#22707)
### Summary Align the MLPerf Tiny inference fixtures with the MLCommons reference graphs. Correct SAME padding, enable convolution biases, and pool over all 25x5 KWS features. Add optional classifier softmax and enable it in the inference wrappers and Cortex-M model tests. Keep the fixed 16/32/64 ResNet stage widths and existing BatchNorm settings. ### Test plan All eight Cortex-M model tests pass, including four Corstone-300 FVP runs. All twelve TOSA model tests pass. Eight XNNPACK export checks and sixteen Ethos-U55/U85 compilation checks pass; these do not include target runtime execution. Formatting and Flake8 pass. Validation uses the repository's pinned PyTorch 2.13 and torchao versions. Authored with OpenAI Codex. cc @digantdesai @freddan80 @per @zingo @oscarandersson8218 @mansnils @Sebastian-Larsson @robell @robert-kalmar @JakeStevens
1 parent 1a9f86d commit fa1e867

11 files changed

Lines changed: 168 additions & 126 deletions

File tree

‎backends/arm/test/models/test_ds_cnn.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
_wrapper = DSCNNKWSModel()
2323
model = _wrapper.get_eager_model()
2424
# TODO: Remove once a pass decomposes large-stride AvgPool2d.
25-
# Replace AvgPool2d(24,5) with AdaptiveAvgPool2d(1) so the
25+
# Replace AvgPool2d(25,5) with AdaptiveAvgPool2d(1) so the
2626
# DecomposeAdaptiveAvgPool2dPass can break it into stride-1
2727
# pools that satisfy the Ethos-U55 stride <= 3 constraint.
2828
model.pool = nn.AdaptiveAvgPool2d(output_size=1) # type: ignore[assignment]

‎backends/cortex_m/test/models/test_ds_cnn.py‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,16 @@
1010
from executorch.examples.models.mlperf_tiny.ds_cnn import DSCNNKWS
1111

1212
ops_before_transforms: dict[str, int] = {
13+
"executorch_exir_dialects_edge__ops_aten__softmax_default": 1,
1314
"executorch_exir_dialects_edge__ops_aten_avg_pool2d_default": 1,
15+
"executorch_exir_dialects_edge__ops_aten_constant_pad_nd_default": 1,
1416
"executorch_exir_dialects_edge__ops_aten_convolution_default": 9,
1517
"executorch_exir_dialects_edge__ops_aten_linear_default": 1,
1618
"executorch_exir_dialects_edge__ops_aten_relu_default": 9,
1719
"executorch_exir_dialects_edge__ops_aten_view_copy_default": 1,
1820
"executorch_exir_dialects_edge__ops_quantized_decomposed_dequantize_per_channel_default": 18,
19-
"executorch_exir_dialects_edge__ops_quantized_decomposed_dequantize_per_tensor_default": 15,
20-
"executorch_exir_dialects_edge__ops_quantized_decomposed_quantize_per_tensor_default": 13,
21+
"executorch_exir_dialects_edge__ops_quantized_decomposed_dequantize_per_tensor_default": 17,
22+
"executorch_exir_dialects_edge__ops_quantized_decomposed_quantize_per_tensor_default": 15,
2123
}
2224

2325
ops_after_transforms: dict[str, int] = {
@@ -29,11 +31,12 @@
2931
"executorch_exir_dialects_edge__ops_cortex_m_quantized_conv2d_default": 5,
3032
"executorch_exir_dialects_edge__ops_cortex_m_quantized_depthwise_conv2d_default": 4,
3133
"executorch_exir_dialects_edge__ops_cortex_m_quantized_linear_default": 1,
34+
"executorch_exir_dialects_edge__ops_cortex_m_softmax_default": 1,
3235
}
3336

3437
test_cases = {
3538
"ds_cnn": McuTestCase(
36-
model=DSCNNKWS().eval(),
39+
model=DSCNNKWS(apply_softmax=True).eval(),
3740
example_inputs=lambda: (
3841
(torch.rand(1, 1, 49, 10) * 2 - 1).to(memory_format=torch.channels_last),
3942
),

‎backends/cortex_m/test/models/test_mobilenet_v1_025.py‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,16 @@
1010
from executorch.examples.models.mlperf_tiny.mobilenet_v1_025 import MobileNetV1025
1111

1212
ops_before_transforms: dict[str, int] = {
13+
"executorch_exir_dialects_edge__ops_aten__softmax_default": 1,
1314
"executorch_exir_dialects_edge__ops_aten_avg_pool2d_default": 1,
15+
"executorch_exir_dialects_edge__ops_aten_constant_pad_nd_default": 5,
1416
"executorch_exir_dialects_edge__ops_aten_convolution_default": 27,
1517
"executorch_exir_dialects_edge__ops_aten_linear_default": 1,
1618
"executorch_exir_dialects_edge__ops_aten_relu_default": 27,
1719
"executorch_exir_dialects_edge__ops_aten_view_copy_default": 1,
1820
"executorch_exir_dialects_edge__ops_quantized_decomposed_dequantize_per_channel_default": 54,
19-
"executorch_exir_dialects_edge__ops_quantized_decomposed_dequantize_per_tensor_default": 33,
20-
"executorch_exir_dialects_edge__ops_quantized_decomposed_quantize_per_tensor_default": 31,
21+
"executorch_exir_dialects_edge__ops_quantized_decomposed_dequantize_per_tensor_default": 39,
22+
"executorch_exir_dialects_edge__ops_quantized_decomposed_quantize_per_tensor_default": 37,
2123
}
2224

2325
ops_after_transforms: dict[str, int] = {
@@ -29,11 +31,12 @@
2931
"executorch_exir_dialects_edge__ops_cortex_m_quantized_conv2d_default": 14,
3032
"executorch_exir_dialects_edge__ops_cortex_m_quantized_depthwise_conv2d_default": 13,
3133
"executorch_exir_dialects_edge__ops_cortex_m_quantized_linear_default": 1,
34+
"executorch_exir_dialects_edge__ops_cortex_m_softmax_default": 1,
3235
}
3336

3437
test_cases = {
3538
"mobilenet_v1_025": McuTestCase(
36-
model=MobileNetV1025().eval(),
39+
model=MobileNetV1025(apply_softmax=True).eval(),
3740
example_inputs=lambda: (
3841
(torch.rand(1, 3, 96, 96) * 2 - 1).to(memory_format=torch.channels_last),
3942
),

‎backends/cortex_m/test/models/test_resnet8.py‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,17 @@
1010
from executorch.examples.models.mlperf_tiny.resnet8 import ResNet8
1111

1212
ops_before_transforms: dict[str, int] = {
13+
"executorch_exir_dialects_edge__ops_aten__softmax_default": 1,
1314
"executorch_exir_dialects_edge__ops_aten_add_Tensor": 3,
1415
"executorch_exir_dialects_edge__ops_aten_avg_pool2d_default": 1,
16+
"executorch_exir_dialects_edge__ops_aten_constant_pad_nd_default": 2,
1517
"executorch_exir_dialects_edge__ops_aten_convolution_default": 9,
1618
"executorch_exir_dialects_edge__ops_aten_linear_default": 1,
1719
"executorch_exir_dialects_edge__ops_aten_relu_default": 7,
1820
"executorch_exir_dialects_edge__ops_aten_view_copy_default": 1,
19-
"executorch_exir_dialects_edge__ops_quantized_decomposed_dequantize_per_channel_default": 16,
20-
"executorch_exir_dialects_edge__ops_quantized_decomposed_dequantize_per_tensor_default": 21,
21-
"executorch_exir_dialects_edge__ops_quantized_decomposed_quantize_per_tensor_default": 16,
21+
"executorch_exir_dialects_edge__ops_quantized_decomposed_dequantize_per_channel_default": 18,
22+
"executorch_exir_dialects_edge__ops_quantized_decomposed_dequantize_per_tensor_default": 24,
23+
"executorch_exir_dialects_edge__ops_quantized_decomposed_quantize_per_tensor_default": 19,
2224
}
2325

2426
ops_after_transforms: dict[str, int] = {
@@ -30,11 +32,12 @@
3032
"executorch_exir_dialects_edge__ops_cortex_m_quantized_avg_pool2d_default": 1,
3133
"executorch_exir_dialects_edge__ops_cortex_m_quantized_conv2d_default": 9,
3234
"executorch_exir_dialects_edge__ops_cortex_m_quantized_linear_default": 1,
35+
"executorch_exir_dialects_edge__ops_cortex_m_softmax_default": 1,
3336
}
3437

3538
test_cases = {
3639
"resnet8": McuTestCase(
37-
model=ResNet8().eval(),
40+
model=ResNet8(apply_softmax=True).eval(),
3841
example_inputs=lambda: (
3942
(torch.rand(1, 3, 32, 32) * 2 - 1).to(memory_format=torch.channels_last),
4043
),

‎backends/nxp/tests/generic_tests/test_profiling.py‎

Lines changed: 86 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -397,23 +397,23 @@ def test__resnet8(self, caplog, request):
397397
)
398398
neutron_map = extract_map_from_logs(caplog)
399399
assert neutron_map == {
400-
0: (14, 15), # Conv2DStandardV2 (Pad + Conv)
401-
1: (17, 18), # Conv2DStandardV1 (Pad + Conv)
402-
2: (20,), # Conv2DStandardV1
403-
3: (21,), # Add
404-
4: (22,), # GlobalBiasScale (Relu)
405-
5: (28,), # Conv2DStandardV1
406-
6: (24, 25), # Conv2DStandardV1 (Pad + Conv)
407-
7: (27,), # Conv2DStandardV1
408-
8: (29,), # Add
409-
9: (30,), # GlobalBiasScale (Relu)
410-
10: (36,), # Conv2DStandardV1
411-
11: (32, 33), # Conv2DStandardV1 (Pad + Conv)
412-
12: (35,), # Conv2DStandardV1
413-
13: (37,), # Add
414-
14: (38,), # GlobalBiasScale (Relu)
415-
15: (39, 40), # GlobalAvgPool (Mean + Reshape)
416-
16: (41,), # FullyConnected
400+
0: (22, 23), # Conv2DStandardV2 (Pad + Conv)
401+
1: (24, 25), # Conv2DStandardV1 (Pad + Conv)
402+
2: (26,), # Conv2DStandardV1
403+
3: (27,), # Add
404+
4: (28,), # GlobalBiasScale (Relu)
405+
5: (33,), # Conv2DStandardV1
406+
6: (29, 30, 31), # Conv2DStandardV1 (Pad + Conv)
407+
7: (32,), # Conv2DStandardV1
408+
8: (34,), # Add
409+
9: (35,), # GlobalBiasScale (Relu)
410+
10: (40,), # Conv2DStandardV1
411+
11: (36, 37, 38), # Conv2DStandardV1 (Pad + Conv)
412+
12: (39,), # Conv2DStandardV1
413+
13: (41,), # Add
414+
14: (42,), # GlobalBiasScale (Relu)
415+
15: (43, 44), # GlobalAvgPool (Mean + Reshape)
416+
16: (45,), # FullyConnected
417417
17: (), # Neutron Dump
418418
}
419419

@@ -434,34 +434,34 @@ def test__resnet8_batch_2(self, caplog, request):
434434
)
435435
neutron_map = extract_map_from_logs(caplog)
436436
assert neutron_map == {
437-
0: (14, 15), # Conv2DStandardV2 (1/2 batch item)
438-
1: (14, 15), # Conv2DStandardV2 (2/2 batch item)
439-
2: (17, 18), # Conv2DStandardV1 (1/2 batch item)
440-
3: (17, 18), # Conv2DStandardV1 (2/2 batch item)
441-
4: (20,), # Conv2DStandardV1 (1/2 batch item)
442-
5: (20,), # Conv2DStandardV1 (2/2 batch item)
443-
6: (21,), # Add
444-
7: (22,), # GlobalBiasScale (Relu)
445-
8: (28,), # Conv2DStandardV1 (1/2 batch item)
446-
9: (28,), # Conv2DStandardV1 (2/2 batch item)
447-
10: (24, 25), # Conv2DStandardV1 (1/2 batch item)
448-
11: (24, 25), # Conv2DStandardV1 (2/2 batch item)
449-
12: (27,), # Conv2DStandardV1 (1/2 batch item)
450-
13: (27,), # Conv2DStandardV1 (2/2 batch item)
451-
14: (29,), # Add
452-
15: (30,), # GlobalBiasScale (Relu)
453-
16: (36,), # Conv2DStandardV1 (1/2 batch item)
454-
17: (36,), # Conv2DStandardV1 (2/2 batch item)
455-
18: (32, 33), # Conv2DStandardV1 (1/2 batch item)
456-
19: (32, 33), # Conv2DStandardV1 (2/2 batch item)
457-
20: (35,), # Conv2DStandardV1 (1/2 batch item)
458-
21: (35,), # Conv2DStandardV1 (2/2 batch item)
459-
22: (37,), # Add
460-
23: (38,), # GlobalBiasScale (Relu)
461-
24: (39,), # GlobalAvgPool (1/2 batch item)
462-
25: (39,), # GlobalAvgPool (2/2 batch item)
463-
26: (41,), # Conv2DPointwise (FullyConnected)
464-
27: (41,), # Slice (FullyConnected)
437+
0: (22, 23), # Conv2DStandardV2 (1/2 batch item)
438+
1: (22, 23), # Conv2DStandardV2 (2/2 batch item)
439+
2: (24, 25), # Conv2DStandardV1 (1/2 batch item)
440+
3: (24, 25), # Conv2DStandardV1 (2/2 batch item)
441+
4: (26,), # Conv2DStandardV1 (1/2 batch item)
442+
5: (26,), # Conv2DStandardV1 (2/2 batch item)
443+
6: (27,), # Add
444+
7: (28,), # GlobalBiasScale (Relu)
445+
8: (33,), # Conv2DStandardV1 (1/2 batch item)
446+
9: (33,), # Conv2DStandardV1 (2/2 batch item)
447+
10: (29, 30, 31), # Conv2DStandardV1 (1/2 batch item)
448+
11: (29, 30, 31), # Conv2DStandardV1 (2/2 batch item)
449+
12: (32,), # Conv2DStandardV1 (1/2 batch item)
450+
13: (32,), # Conv2DStandardV1 (2/2 batch item)
451+
14: (34,), # Add
452+
15: (35,), # GlobalBiasScale (Relu)
453+
16: (40,), # Conv2DStandardV1 (1/2 batch item)
454+
17: (40,), # Conv2DStandardV1 (2/2 batch item)
455+
18: (36, 37, 38), # Conv2DStandardV1 (1/2 batch item)
456+
19: (36, 37, 38), # Conv2DStandardV1 (2/2 batch item)
457+
20: (39,), # Conv2DStandardV1 (1/2 batch item)
458+
21: (39,), # Conv2DStandardV1 (2/2 batch item)
459+
22: (41,), # Add
460+
23: (42,), # GlobalBiasScale (Relu)
461+
24: (43,), # GlobalAvgPool (1/2 batch item)
462+
25: (43,), # GlobalAvgPool (2/2 batch item)
463+
26: (45,), # Conv2DPointwise (FullyConnected)
464+
27: (45,), # Slice (FullyConnected)
465465
28: (), # Neutron Dump
466466
}
467467
inspector_check(get_test_name(request))
@@ -483,18 +483,18 @@ def test__ds_cnn(self, caplog, request):
483483
)
484484
neutron_map = extract_map_from_logs(caplog)
485485
assert neutron_map == {
486-
0: (14, 15), # Pad (Conv + Relu)
487-
1: (14, 15), # Conv2DStandardV2 (Conv + Relu)
488-
2: (18, 19), # Conv2DDepthwiseV1 (DepthwiseConv + Relu)
489-
3: (21, 22), # Conv2DPointwise (Conv + Relu)
490-
4: (24, 25), # Conv2DDepthwiseV1 (DepthwiseConv + Relu)
491-
5: (27, 28), # Conv2DDepthwiseV1 (Conv + Relu)
492-
6: (30, 31), # Conv2DDepthwiseV1 (DepthwiseConv + Relu)
493-
7: (33, 34), # Conv2DPointwise (Conv + Relu)
494-
8: (36, 37), # Conv2DDepthwiseV1 (DepthwiseConv + Relu)
495-
9: (39, 40), # Conv2DPointwise (Conv + Relu)
496-
10: (42,), # Conv2DDepthwiseDense (AvgPool)
497-
11: (44,), # FullyConnected
486+
0: (22, 23, 24), # Pad (Pad + Conv + Relu)
487+
1: (22, 23, 24), # Conv2DStandardV2 (Pad + Conv + Relu)
488+
2: (26, 27), # Conv2DDepthwiseV1 (DepthwiseConv + Relu)
489+
3: (28, 29), # Conv2DPointwise (Conv + Relu)
490+
4: (30, 31), # Conv2DDepthwiseV1 (DepthwiseConv + Relu)
491+
5: (32, 33), # Conv2DDepthwiseV1 (Conv + Relu)
492+
6: (34, 35), # Conv2DDepthwiseV1 (DepthwiseConv + Relu)
493+
7: (36, 37), # Conv2DPointwise (Conv + Relu)
494+
8: (38, 39), # Conv2DDepthwiseV1 (DepthwiseConv + Relu)
495+
9: (40, 41), # Conv2DPointwise (Conv + Relu)
496+
10: (43, 44), # Conv2DDepthwiseDense (AvgPool + Reshape)
497+
11: (45,), # FullyConnected
498498
12: (), # Neutron Dump
499499
}
500500

@@ -515,35 +515,35 @@ def test__mobilenet_v1_025(self, caplog, request):
515515
)
516516
neutron_map = extract_map_from_logs(caplog)
517517
assert neutron_map == {
518-
0: (32, 33), # Conv2DStandardV2 (Conv + Relu)
519-
1: (35, 36), # Conv2DDepthwiseV1 (DepthwiseConv + Relu)
520-
2: (38, 39), # Conv2DPointwise (Conv + Relu)
521-
3: (41, 42), # Conv2DDepthwiseV1 (DepthwiseConv + Relu)
522-
4: (44, 45), # Conv2DPointwise (Conv + Relu)
523-
5: (47, 48), # Conv2DDepthwiseV1 (DepthwiseConv + Relu)
524-
6: (50, 51), # Conv2DPointwise (Conv + Relu)
525-
7: (53, 54), # Conv2DDepthwiseV1 (DepthwiseConv + Relu)
526-
8: (56, 57), # Conv2DPointwise (Conv + Relu)
527-
9: (59, 60), # Conv2DDepthwiseV1 (DepthwiseConv + Relu)
528-
10: (62, 63), # Conv2DPointwise (Conv + Relu)
529-
11: (65, 66), # Conv2DDepthwiseV1 (DepthwiseConv + Relu)
530-
12: (68, 69), # Conv2DPointwise (Conv + Relu)
531-
13: (71, 72), # Conv2DDepthwiseV1 (DepthwiseConv + Relu)
532-
14: (74, 75), # Conv2DPointwise (Conv + Relu)
533-
15: (77, 78), # Conv2DDepthwiseV1 (DepthwiseConv + Relu)
534-
16: (80, 81), # Conv2DPointwise (Conv + Relu)
535-
17: (83, 84), # Conv2DDepthwiseV1 (DepthwiseConv + Relu)
536-
18: (86, 87), # Conv2DPointwise (Conv + Relu)
537-
19: (89, 90), # Conv2DDepthwiseV1 (DepthwiseConv + Relu)
538-
20: (92, 93), # Conv2DPointwise (Conv + Relu)
539-
21: (95, 96), # Conv2DDepthwiseV1 (DepthwiseConv + Relu)
540-
22: (98, 99), # Conv2DPointwise (Conv + Relu)
541-
23: (101, 102), # Conv2DDepthwiseDense (DepthwiseConv + Relu)
542-
24: (104, 105), # Conv2DPointwise (Conv + Relu)
543-
25: (107, 108), # Conv2DDepthwiseDense (DepthwiseConv + Relu)
544-
26: (110, 111), # Conv2DPointwise (Conv + Relu)
545-
27: (112, 113), # GlobalAvgPool (Mean + Reshape)
546-
28: (114,), # FullyConnected
518+
0: (58, 59, 60), # Conv2DStandardV2 (Pad + Conv + Relu)
519+
1: (61, 62), # Conv2DDepthwiseV1 (DepthwiseConv + Relu)
520+
2: (63, 64), # Conv2DPointwise (Conv + Relu)
521+
3: (65, 66, 67), # Conv2DDepthwiseV1 (Pad + DepthwiseConv + Relu)
522+
4: (68, 69), # Conv2DPointwise (Conv + Relu)
523+
5: (70, 71), # Conv2DDepthwiseV1 (DepthwiseConv + Relu)
524+
6: (72, 73), # Conv2DPointwise (Conv + Relu)
525+
7: (74, 75, 76), # Conv2DDepthwiseV1 (Pad + DepthwiseConv + Relu)
526+
8: (77, 78), # Conv2DPointwise (Conv + Relu)
527+
9: (79, 80), # Conv2DDepthwiseV1 (DepthwiseConv + Relu)
528+
10: (81, 82), # Conv2DPointwise (Conv + Relu)
529+
11: (83, 84, 85), # Conv2DDepthwiseV1 (Pad + DepthwiseConv + Relu)
530+
12: (86, 87), # Conv2DPointwise (Conv + Relu)
531+
13: (88, 89), # Conv2DDepthwiseV1 (DepthwiseConv + Relu)
532+
14: (90, 91), # Conv2DPointwise (Conv + Relu)
533+
15: (92, 93), # Conv2DDepthwiseV1 (DepthwiseConv + Relu)
534+
16: (94, 95), # Conv2DPointwise (Conv + Relu)
535+
17: (96, 97), # Conv2DDepthwiseV1 (DepthwiseConv + Relu)
536+
18: (98, 99), # Conv2DPointwise (Conv + Relu)
537+
19: (100, 101), # Conv2DDepthwiseV1 (DepthwiseConv + Relu)
538+
20: (102, 103), # Conv2DPointwise (Conv + Relu)
539+
21: (104, 105), # Conv2DDepthwiseV1 (DepthwiseConv + Relu)
540+
22: (106, 107), # Conv2DPointwise (Conv + Relu)
541+
23: (108, 109, 110), # Conv2DDepthwiseDense (Pad + DepthwiseConv + Relu)
542+
24: (111, 112), # Conv2DPointwise (Conv + Relu)
543+
25: (113, 114), # Conv2DDepthwiseDense (DepthwiseConv + Relu)
544+
26: (115, 116), # Conv2DPointwise (Conv + Relu)
545+
27: (117, 118), # GlobalAvgPool (Mean + Reshape)
546+
28: (119,), # FullyConnected
547547
29: (), # Neutron Dump
548548
}
549549

‎backends/nxp/tests/models/test_mlperf_tiny_image_classification.py‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,21 @@ def test_mlperf_tiny_classification_mse_cpu_vs_npu(
8080
else None
8181
)
8282

83+
# Portable constant_pad_nd does not support channels-last tensors.
84+
ref_model = (
85+
ReferenceModel.QUANTIZED_EDGE_PYTHON
86+
if channels_last
87+
else ReferenceModel.QUANTIZED_EXECUTORCH_CPP
88+
)
89+
8390
lower_run_compare(
8491
model,
8592
[input_spec],
8693
model_verifier,
8794
request,
8895
dataset_creator=dataset_creator,
8996
output_comparator=comparator,
90-
reference_model=ReferenceModel.QUANTIZED_EXECUTORCH_CPP,
97+
reference_model=ref_model,
9198
mocker=mocker,
9299
use_qat=use_qat,
93100
train_fn=train_fn,

‎backends/nxp/tests/models/test_mlperf_tiny_keyword_spotting.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@
3232
BOUNDS_MSE = {
3333
"PTQ": {
3434
"channels-last": np.inf,
35-
"channels-first": 5.5e-7,
35+
"channels-first": 2.0e-6,
3636
},
3737
"QAT": {
3838
"channels-last": np.inf,
39-
"channels-first": 3.3e-5,
39+
"channels-first": 5.0e-5,
4040
},
4141
}
4242

‎backends/nxp/tests/models/test_mlperf_tiny_visual_wake_words.py‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,15 @@
2323
from executorch.backends.nxp.tests.nsys_testing import (
2424
lower_run_compare,
2525
lower_run_compare_ptq_qat,
26+
ReferenceModel,
2627
)
2728
from executorch.backends.nxp.tests.use_qat import * # noqa F403
2829
from executorch.examples.nxp.models.mlperf_tiny.visual_wake_words.mlperf_tiny_visual_wake_words import (
2930
MLPerfTinyVisualWakeWords,
3031
)
3132

3233
BOUNDS_MSE = {
33-
"PTQ": {"channels-last": 4.6e-8, "channels-first": 5.0e-8},
34+
"PTQ": {"channels-last": 1.1e-7, "channels-first": 5.0e-8},
3435
"QAT": {"channels-last": 3.0e-6, "channels-first": 3.7e-6},
3536
}
3637

@@ -75,13 +76,21 @@ def test_mlperf_tiny_vww_mse_cpu_vs_npu(mocker, request, channels_last, use_qat)
7576
else None
7677
)
7778

79+
# Portable constant_pad_nd does not support channels-last tensors.
80+
ref_model = (
81+
ReferenceModel.QUANTIZED_EDGE_PYTHON
82+
if channels_last
83+
else ReferenceModel.QUANTIZED_EXECUTORCH_CPP
84+
)
85+
7886
lower_run_compare(
7987
model,
8088
[input_spec],
8189
model_verifier,
8290
request,
8391
dataset_creator=dataset_creator,
8492
output_comparator=comparator,
93+
reference_model=ref_model,
8594
mocker=mocker,
8695
use_qat=use_qat,
8796
train_fn=train_fn,

0 commit comments

Comments
 (0)