1010from executorch .backends .nxp .tests .executorch_pipeline import to_edge_program
1111from executorch .backends .nxp .tests .executors import convert_run_compare
1212from executorch .backends .nxp .tests .models import LinearModule
13+ from executorch .exir .dialects ._ops import ops as exir_ops
1314
1415
1516@pytest .fixture (autouse = True )
@@ -26,15 +27,23 @@ def test_linear_conversion__with_bias():
2627
2728 input_data = np .random .random (input_shape ).astype (np .float32 )
2829
29- convert_run_compare (edge_program , input_data = input_data , atol = 1.0e-6 )
30+ nodes = list (edge_program .graph .nodes )
31+ assert nodes [4 ].target == exir_ops .edge .aten .addmm .default
32+ assert len (nodes [4 ].args ) == 3 # Has bias.
33+
34+ convert_run_compare (edge_program , input_data = input_data )
3035
3136
3237def test_linear_conversion__without_bias ():
3338 input_shape = (10 , 32 )
3439 edge_program = to_edge_program (
35- LinearModule (bias = True ), input_shape
40+ LinearModule (bias = False ), input_shape
3641 ).exported_program ()
3742
3843 input_data = np .random .random (input_shape ).astype (np .float32 )
3944
40- convert_run_compare (edge_program , input_data = input_data , atol = 1.0e-6 )
45+ nodes = list (edge_program .graph .nodes )
46+ assert nodes [3 ].target == exir_ops .edge .aten .mm .default
47+ assert len (nodes [3 ].args ) == 2 # No bias.
48+
49+ convert_run_compare (edge_program , input_data = input_data )
0 commit comments