|
11 | 11 | from executorch import exir |
12 | 12 | from executorch.backends.xnnpack.passes import XNNPACKPassManager |
13 | 13 | from executorch.backends.xnnpack.passes.convert_to_linear import ConvertToLinearPass |
14 | | -from executorch.backends.xnnpack.passes.remove_getitem_op import RemoveGetItemPass |
15 | 14 | from executorch.backends.xnnpack.passes.tag_implicit_q_dq_pass import TagImplicitQDqPass |
16 | 15 |
|
17 | 16 | from executorch.backends.xnnpack.utils.configs import get_xnnpack_capture_config |
@@ -89,73 +88,6 @@ def capture_and_test_pass( |
89 | 88 | ) |
90 | 89 | return new_exported_program |
91 | 90 |
|
92 | | - def test_max_pool2d_remove_getitem(self) -> None: |
93 | | - passes = [RemoveGetItemPass()] |
94 | | - |
95 | | - class MaxPool2dModule(torch.nn.Module): |
96 | | - def __init__( |
97 | | - self, |
98 | | - kernel_size=3, |
99 | | - stride=1, |
100 | | - padding=0, |
101 | | - dilation=1, |
102 | | - ): |
103 | | - super().__init__() |
104 | | - self.max_pool2d_module = torch.nn.MaxPool2d( |
105 | | - kernel_size=kernel_size, |
106 | | - stride=stride, |
107 | | - padding=padding, |
108 | | - dilation=dilation, |
109 | | - ) |
110 | | - |
111 | | - def forward(self, x): |
112 | | - return self.max_pool2d_module(x) |
113 | | - |
114 | | - maxpool2d_module = MaxPool2dModule(3, 1, 0, 1) |
115 | | - model_inputs = (torch.randn(4, 3, 24, 24),) |
116 | | - |
117 | | - edge_ep = capture_graph_for_xnnpack(maxpool2d_module.eval(), model_inputs) |
118 | | - new_ep = edge_ep.transform(*passes) |
119 | | - result1 = edge_ep(model_inputs[0])[0] |
120 | | - result2 = new_ep(model_inputs[0])[0] |
121 | | - |
122 | | - # Filecheck exir_ops.edge.aten.max_pool2d.default node. |
123 | | - FileCheck().check_count( |
124 | | - "executorch_exir_dialects_edge__ops_aten_max_pool2d_default", |
125 | | - 1, |
126 | | - exactly=True, |
127 | | - ).run(new_ep.exported_program.graph_module.code) |
128 | | - |
129 | | - self.assertTrue(torch.allclose(result1, result2)) |
130 | | - |
131 | | - def test_max_remove_getitem(self) -> None: |
132 | | - passes = [RemoveGetItemPass()] |
133 | | - |
134 | | - class MaxModule(torch.nn.Module): |
135 | | - def __init__( |
136 | | - self, |
137 | | - ): |
138 | | - super().__init__() |
139 | | - |
140 | | - def forward(self, x): |
141 | | - max_vals, indices = torch.max(x, dim=2, keepdim=True) |
142 | | - return max_vals |
143 | | - |
144 | | - max_module = MaxModule() |
145 | | - model_inputs = (torch.randn(4, 3, 24, 24),) |
146 | | - |
147 | | - edge_ep = capture_graph_for_xnnpack(max_module.eval(), model_inputs) |
148 | | - |
149 | | - new_ep = edge_ep.transform(*passes) |
150 | | - result1 = edge_ep(model_inputs[0])[0] |
151 | | - result2 = new_ep(model_inputs[0])[0] |
152 | | - |
153 | | - # Filecheck exir_ops.edge.aten.amax.default node. |
154 | | - FileCheck().check_count( |
155 | | - "executorch_exir_dialects_edge__ops_aten_amax_default", 1, exactly=True |
156 | | - ).run(new_ep.exported_program.graph_module.code) |
157 | | - |
158 | | - self.assertTrue(torch.allclose(result1, result2)) |
159 | 91 |
|
160 | 92 | # TODO T154127848: Move this out of XNNPACK dir and into cannonical_partitioner dir |
161 | 93 | def test_duplicate_dequant_node_pass(self) -> None: |
|
0 commit comments