10
10
from executorch .backends .nxp .tests .executorch_pipeline import to_edge_program
11
11
from executorch .backends .nxp .tests .executors import convert_run_compare
12
12
from executorch .backends .nxp .tests .models import LinearModule
13
+ from executorch .exir .dialects ._ops import ops as exir_ops
13
14
14
15
15
16
@pytest .fixture (autouse = True )
@@ -26,15 +27,23 @@ def test_linear_conversion__with_bias():
26
27
27
28
input_data = np .random .random (input_shape ).astype (np .float32 )
28
29
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 )
30
35
31
36
32
37
def test_linear_conversion__without_bias ():
33
38
input_shape = (10 , 32 )
34
39
edge_program = to_edge_program (
35
- LinearModule (bias = True ), input_shape
40
+ LinearModule (bias = False ), input_shape
36
41
).exported_program ()
37
42
38
43
input_data = np .random .random (input_shape ).astype (np .float32 )
39
44
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