66from typing import cast , Dict , Protocol , Tuple
77
88import torch
9- from executorch .backends .arm ._passes import RewriteAvgPool2dPass
9+ from executorch .backends .arm ._passes . rewrite_avg_pool2d_pass import RewriteAvgPool2dPass
1010from executorch .backends .arm .test import common
1111from executorch .backends .arm .test .tester .test_pipeline import PassPipeline
1212from executorch .backends .test .harness .stages import StageType
@@ -29,31 +29,31 @@ def forward(self, x: torch.Tensor) -> torch.Tensor:
2929
3030class AvgPool2dWithoutStride (torch .nn .Module ):
3131 def get_inputs (self ) -> input_t :
32- return (torch .rand (1 , 3 , 9 , 9 ),)
32+ return (torch .rand (1 , 3 , 8 , 8 ),)
3333
3434 def forward (self , x : torch .Tensor ) -> torch .Tensor :
3535 return torch .nn .functional .avg_pool2d (x , kernel_size = 3 )
3636
3737
3838class AvgPool2dListKernel (torch .nn .Module ):
3939 def get_inputs (self ) -> input_t :
40- return (torch .rand (1 , 3 , 8 , 9 ),)
40+ return (torch .rand (1 , 3 , 8 , 8 ),)
4141
4242 def forward (self , x : torch .Tensor ) -> torch .Tensor :
4343 return torch .nn .functional .avg_pool2d (x , kernel_size = [2 , 3 ])
4444
4545
4646class AvgPool2dScalarPadding (torch .nn .Module ):
4747 def get_inputs (self ) -> input_t :
48- return (torch .rand (1 , 3 , 9 , 9 ),)
48+ return (torch .rand (1 , 3 , 8 , 8 ),)
4949
5050 def forward (self , x : torch .Tensor ) -> torch .Tensor :
5151 return torch .nn .functional .avg_pool2d (x , kernel_size = 3 , stride = 2 , padding = 1 )
5252
5353
5454class AvgPool2dWithEmptyStride (torch .nn .Module ):
5555 def get_inputs (self ) -> input_t :
56- return (torch .rand (1 , 3 , 8 , 9 ),)
56+ return (torch .rand (1 , 3 , 8 , 8 ),)
5757
5858 def forward (self , x : torch .Tensor ) -> torch .Tensor :
5959 return torch .nn .functional .avg_pool2d (x , kernel_size = [2 , 3 ], stride = [])
@@ -81,6 +81,9 @@ def test_rewrite_avg_pool2d_tosa(module: ModuleWithInputs) -> None:
8181 },
8282 pass_list = [RewriteAvgPool2dPass ],
8383 )
84+ pipeline .pop_stage (
85+ "run_method_and_compare_outputs"
86+ ) # Cannot run aten graph with tosa dialect ops
8487 pipeline .run ()
8588
8689
@@ -116,6 +119,7 @@ def test_rewrite_avg_pool2d_tosa_empty_stride_uses_kernel_size() -> None:
116119 },
117120 pass_list = [RewriteAvgPool2dPass ],
118121 )
122+ pipeline .pop_stage ("run_method_and_compare_outputs" )
119123 pipeline .run ()
120124
121125 tosa_node = _get_tosa_avg_pool2d_node (pipeline )
0 commit comments