@@ -32,6 +32,20 @@ def _test_abs(self, inputs):
32
32
.run_method_and_compare_outputs ()
33
33
)
34
34
35
+ def _test_abs_legacy_mode (self , inputs ):
36
+ (
37
+ Tester (self .Abs (), inputs )
38
+ .export ()
39
+ .check_count ({"torch.ops.aten.abs.default" : 1 })
40
+ .to_edge ()
41
+ .partition ()
42
+ .check_count ({"torch.ops.higher_order.executorch_call_delegate" : 1 })
43
+ .check_not (["executorch_exir_dialects_edge__ops_aten_abs_default" ])
44
+ .to_executorch ()
45
+ .serialize ()
46
+ .run_method_and_compare_outputs ()
47
+ )
48
+
35
49
def test_fp16_abs (self ):
36
50
inputs = (
37
51
torch .Tensor (
@@ -43,6 +57,17 @@ def test_fp16_abs(self):
43
57
)
44
58
self ._test_abs (inputs )
45
59
60
+ def test_fp16_abs_legacy_mode (self ):
61
+ inputs = (
62
+ torch .Tensor (
63
+ [
64
+ [0.0 , 0.1 , 0.5 , 0.499 ],
65
+ [- 0.6 , - 0.4 , 100.1 , - 1000.1 ],
66
+ ],
67
+ ).to (torch .float16 ),
68
+ )
69
+ self ._test_abs_legacy_mode (inputs )
70
+
46
71
def test_fp32_abs (self ):
47
72
inputs = (
48
73
torch .Tensor (
@@ -53,3 +78,14 @@ def test_fp32_abs(self):
53
78
),
54
79
)
55
80
self ._test_abs (inputs )
81
+
82
+ def test_fp32_abs_legacy_mode (self ):
83
+ inputs = (
84
+ torch .Tensor (
85
+ [
86
+ [0.0 , 0.1 , 0.5 , 0.499 ],
87
+ [- 0.6 , - 0.4 , 100.1 , - 1000.1 ],
88
+ ],
89
+ ),
90
+ )
91
+ self ._test_abs_legacy_mode (inputs )
0 commit comments