@@ -345,6 +345,60 @@ def test_op_tanh(self):
345345 model , torch .abs (torch .rand (3 , 4 , 5 , dtype = torch .float32 )), atol = 1e-6
346346 )
347347
348+ def test_op_reduce_max (self ):
349+ model = oh .make_model (
350+ oh .make_graph (
351+ [oh .make_node ("ReduceMax" , ["X" , "axes" ], ["Z" ])],
352+ "dummy" ,
353+ [
354+ oh .make_tensor_value_info ("X" , TFLOAT , ["a" , "b" , "c" ]),
355+ oh .make_tensor_value_info ("axes" , TINT64 , ["f" ]),
356+ ],
357+ [oh .make_tensor_value_info ("Z" , TFLOAT , ["a" , "b" , "c" ])],
358+ ),
359+ ir_version = 9 ,
360+ opset_imports = [oh .make_opsetid ("" , 18 )],
361+ )
362+ self ._finalize_test (
363+ model ,
364+ torch .rand (3 , 4 , 5 , dtype = torch .float32 ),
365+ torch .tensor ([1 ], dtype = torch .int64 ),
366+ atol = 1e-6 ,
367+ )
368+ self ._finalize_test (
369+ model ,
370+ torch .rand (3 , 4 , 5 , dtype = torch .float32 ),
371+ torch .tensor ([1 , 2 ], dtype = torch .int64 ),
372+ atol = 1e-6 ,
373+ )
374+
375+ def test_op_reduce_mean (self ):
376+ model = oh .make_model (
377+ oh .make_graph (
378+ [oh .make_node ("ReduceMean" , ["X" , "axes" ], ["Z" ])],
379+ "dummy" ,
380+ [
381+ oh .make_tensor_value_info ("X" , TFLOAT , ["a" , "b" , "c" ]),
382+ oh .make_tensor_value_info ("axes" , TINT64 , ["f" ]),
383+ ],
384+ [oh .make_tensor_value_info ("Z" , TFLOAT , ["a" , "b" , "c" ])],
385+ ),
386+ ir_version = 9 ,
387+ opset_imports = [oh .make_opsetid ("" , 18 )],
388+ )
389+ self ._finalize_test (
390+ model ,
391+ torch .rand (3 , 4 , 5 , dtype = torch .float32 ),
392+ torch .tensor ([1 ], dtype = torch .int64 ),
393+ atol = 1e-6 ,
394+ )
395+ self ._finalize_test (
396+ model ,
397+ torch .rand (3 , 4 , 5 , dtype = torch .float32 ),
398+ torch .tensor ([1 , 2 ], dtype = torch .int64 ),
399+ atol = 1e-6 ,
400+ )
401+
348402 def test_op_reduce_min (self ):
349403 model = oh .make_model (
350404 oh .make_graph (
@@ -372,6 +426,33 @@ def test_op_reduce_min(self):
372426 atol = 1e-6 ,
373427 )
374428
429+ def test_op_reduce_sum (self ):
430+ model = oh .make_model (
431+ oh .make_graph (
432+ [oh .make_node ("ReduceSum" , ["X" , "axes" ], ["Z" ])],
433+ "dummy" ,
434+ [
435+ oh .make_tensor_value_info ("X" , TFLOAT , ["a" , "b" , "c" ]),
436+ oh .make_tensor_value_info ("axes" , TINT64 , ["f" ]),
437+ ],
438+ [oh .make_tensor_value_info ("Z" , TFLOAT , ["a" , "b" , "c" ])],
439+ ),
440+ ir_version = 9 ,
441+ opset_imports = [oh .make_opsetid ("" , 18 )],
442+ )
443+ self ._finalize_test (
444+ model ,
445+ torch .rand (3 , 4 , 5 , dtype = torch .float32 ),
446+ torch .tensor ([1 ], dtype = torch .int64 ),
447+ atol = 1e-6 ,
448+ )
449+ self ._finalize_test (
450+ model ,
451+ torch .rand (3 , 4 , 5 , dtype = torch .float32 ),
452+ torch .tensor ([1 , 2 ], dtype = torch .int64 ),
453+ atol = 1e-6 ,
454+ )
455+
375456
376457if __name__ == "__main__" :
377458 unittest .main (verbosity = 2 )
0 commit comments