@@ -173,9 +173,33 @@ def test_qnn_backend_arange(self):
173173 self .lower_module_and_test_output (module , sample_input )
174174
175175 def test_qnn_backend_argmax (self ):
176- module = Argmax () # noqa: F405
177- sample_input = (torch .randn (16 , 3 , 4 , 4 ),)
178- self .lower_module_and_test_output (module , sample_input )
176+ test_cases = [
177+ {
178+ "module" : Argmax (), # noqa: F405
179+ "sample_input" : (torch .randn (16 , 3 , 4 , 4 ),),
180+ },
181+ {
182+ "module" : Argmax (dim = 0 , keepdim = True ), # noqa: F405
183+ "sample_input" : (torch .randn (16 , 3 , 4 , 4 ),),
184+ },
185+ {
186+ "module" : Argmax (dim = 1 , keepdim = False ), # noqa: F405
187+ "sample_input" : (torch .randn (8 , 5 ),),
188+ },
189+ {
190+ "module" : Argmax (dim = None , keepdim = False ), # noqa: F405
191+ "sample_input" : (torch .tensor ([5.0 ]),),
192+ },
193+ {
194+ "module" : Argmax (dim = 2 , keepdim = True ), # noqa: F405
195+ "sample_input" : (torch .randn (2 , 3 , 4 ),),
196+ },
197+ ]
198+
199+ for i , case in enumerate (test_cases ):
200+ with self .subTest (i = i ):
201+ self .lower_module_and_test_output (case ["module" ], case ["sample_input" ])
202+
179203
180204 def test_qnn_backend_argmin (self ):
181205 module = Argmin () # noqa: F405
@@ -1756,11 +1780,36 @@ def test_qnn_backend_arange(self):
17561780 module = self .get_qdq_module (module , sample_input )
17571781 self .lower_module_and_test_output (module , sample_input )
17581782
1783+
17591784 def test_qnn_backend_argmax (self ):
1760- module = Argmax () # noqa: F405
1761- sample_input = (torch .randn (16 , 3 , 4 , 4 ),)
1762- module = self .get_qdq_module (module , sample_input )
1763- self .lower_module_and_test_output (module , sample_input )
1785+ test_cases = [
1786+ {
1787+ "module" : Argmax (), # noqa: F405
1788+ "sample_input" : (torch .randn (16 , 3 , 4 , 4 ),),
1789+ },
1790+ {
1791+ "module" : Argmax (dim = 0 , keepdim = True ), # noqa: F405
1792+ "sample_input" : (torch .randn (16 , 3 , 4 , 4 ),),
1793+ },
1794+ {
1795+ "module" : Argmax (dim = 1 , keepdim = False ), # noqa: F405
1796+ "sample_input" : (torch .randn (8 , 5 ),),
1797+ },
1798+ {
1799+ "module" : Argmax (dim = None , keepdim = False ), # noqa: F405
1800+ "sample_input" : (torch .tensor ([5.0 ]),),
1801+ },
1802+ {
1803+ "module" : Argmax (dim = 2 , keepdim = True ), # noqa: F405
1804+ "sample_input" : (torch .randn (2 , 3 , 4 ),),
1805+ },
1806+ ]
1807+
1808+ for i , case in enumerate (test_cases ):
1809+ with self .subTest (i = i ):
1810+ module = self .get_qdq_module (case ["module" ], case ["sample_input" ])
1811+ self .lower_module_and_test_output (module , case ["sample_input" ])
1812+
17641813
17651814 def test_qnn_backend_argmin (self ):
17661815 module = Argmin () # noqa: F405
0 commit comments