55
66import executorch .extension .pybindings .portable_lib
77import executorch .kernels .quantized # noqa F401
8+ from executorch .backends .nxp .tests .executors import graph_contains_any_of_ops
9+ from executorch .backends .nxp .tests .ops_aliases import AddMM , Convolution
810from executorch .backends .nxp .tests .use_qat import * # noqa F401
911
1012from executorch .backends .nxp .tests .executorch_pipeline import (
@@ -29,12 +31,10 @@ def test_conv_fc_softmax__to_executorch_program(use_qat):
2931 delegation_info = get_delegation_info (program .graph_module )
3032 assert delegation_info .num_delegated_subgraphs == 1
3133 assert delegation_info .num_non_delegated_nodes == 11
32- assert delegation_info .num_delegated_nodes == 13
34+ assert delegation_info .num_delegated_nodes == 15
3335
34- for node in program .graph .nodes :
35- # Make sure Convolution and AddMM are delegated
36- assert "convolution" not in node .name
37- assert "addmm" not in node .name
36+ # Make sure Convolution and AddMM are delegated.
37+ assert not graph_contains_any_of_ops (program .graph , [Convolution , AddMM ])
3838
3939
4040def test_cifarnet (use_qat ):
@@ -47,7 +47,8 @@ def test_cifarnet(use_qat):
4747 delegation_info = get_delegation_info (exec_prog .exported_program ().graph_module )
4848 assert delegation_info .num_delegated_subgraphs == 1
4949 assert delegation_info .num_non_delegated_nodes == 11
50- assert delegation_info .num_delegated_nodes == 45
50+ assert delegation_info .num_delegated_nodes == 47
5151
5252 nodes = list (exec_prog .exported_program ().graph .nodes )
53+ # `nodes[2].target` is an OpOverload (not and EdgeOpOverload that we usually test against), so just check the name.
5354 assert nodes [2 ].name == "quantized_decomposed_quantize_per_tensor_default"
0 commit comments