@@ -633,6 +633,52 @@ def test_qnn_backend_cumsum(self):
633633 index += 1
634634 self .lower_module_and_test_output (module , sample_input )
635635
636+ def test_qnn_backend_div_mode (self ):
637+ test_comb = [
638+ {
639+ QCOM_MODULE : [
640+ DivMode (rounding_mode = None ), # noqa: F405
641+ DivMode (rounding_mode = "trunc" ), # noqa: F405
642+ DivMode (rounding_mode = "floor" ), # noqa: F405
643+ ],
644+ QCOM_SAMPLE_INPUTS : [
645+ (
646+ torch .tensor ([7.0 , 5.0 , - 3.0 , 8.0 , 1.0 , 9.0 ]).reshape (2 , 3 ),
647+ torch .tensor ([2.0 , 3.0 , 2.0 , 5.0 , 4.0 , 2.0 ]).reshape (2 , 3 ),
648+ ),
649+ ],
650+ },
651+ ]
652+
653+ index = 0
654+ for comb in test_comb :
655+ for module in comb [QCOM_MODULE ]:
656+ for sample_input in comb [QCOM_SAMPLE_INPUTS ]:
657+ with self .subTest (i = index ):
658+ index += 1
659+ self .lower_module_and_test_output (module , sample_input )
660+
661+ def test_qnn_backend_div_scalar_mode (self ):
662+ test_comb = [
663+ {
664+ QCOM_MODULE : [
665+ DivScalarMode (scalar = 2.0 , rounding_mode = "trunc" ), # noqa: F405
666+ DivScalarMode (scalar = 3.0 , rounding_mode = "floor" ), # noqa: F405
667+ ],
668+ QCOM_SAMPLE_INPUTS : [
669+ (torch .tensor ([7.0 , 5.0 , - 3.0 , 8.0 , 1.0 , 9.0 ]).reshape (2 , 3 ),),
670+ ],
671+ },
672+ ]
673+
674+ index = 0
675+ for comb in test_comb :
676+ for module in comb [QCOM_MODULE ]:
677+ for sample_input in comb [QCOM_SAMPLE_INPUTS ]:
678+ with self .subTest (i = index ):
679+ index += 1
680+ self .lower_module_and_test_output (module , sample_input )
681+
636682 def test_qnn_backend_einsum_outer_product (self ):
637683 module = EinsumOuterProduct () # noqa: F405
638684 x = torch .randn (5 )
@@ -3434,6 +3480,54 @@ def test_qnn_backend_cumsum(self):
34343480 module = self .get_qdq_module (module , sample_input )
34353481 self .lower_module_and_test_output (module , sample_input )
34363482
3483+ def test_qnn_backend_div_mode (self ):
3484+ test_comb = [
3485+ {
3486+ QCOM_MODULE : [
3487+ DivMode (rounding_mode = None ), # noqa: F405
3488+ DivMode (rounding_mode = "trunc" ), # noqa: F405
3489+ DivMode (rounding_mode = "floor" ), # noqa: F405
3490+ ],
3491+ QCOM_SAMPLE_INPUTS : [
3492+ (
3493+ torch .tensor ([7.0 , 5.0 , - 3.0 , 8.0 , 1.0 , 9.0 ]).reshape (2 , 3 ),
3494+ torch .tensor ([2.0 , 3.0 , 2.0 , 5.0 , 4.0 , 2.0 ]).reshape (2 , 3 ),
3495+ ),
3496+ ],
3497+ },
3498+ ]
3499+
3500+ index = 0
3501+ for comb in test_comb :
3502+ for module in comb [QCOM_MODULE ]:
3503+ for sample_input in comb [QCOM_SAMPLE_INPUTS ]:
3504+ with self .subTest (i = index ):
3505+ index += 1
3506+ qdq_module = self .get_qdq_module (module , sample_input )
3507+ self .lower_module_and_test_output (qdq_module , sample_input )
3508+
3509+ def test_qnn_backend_div_scalar_mode (self ):
3510+ test_comb = [
3511+ {
3512+ QCOM_MODULE : [
3513+ DivScalarMode (scalar = 2.0 , rounding_mode = "trunc" ), # noqa: F405
3514+ DivScalarMode (scalar = 3.0 , rounding_mode = "floor" ), # noqa: F405
3515+ ],
3516+ QCOM_SAMPLE_INPUTS : [
3517+ (torch .tensor ([7.0 , 5.0 , - 3.0 , 8.0 , 1.0 , 9.0 ]).reshape (2 , 3 ),),
3518+ ],
3519+ },
3520+ ]
3521+
3522+ index = 0
3523+ for comb in test_comb :
3524+ for module in comb [QCOM_MODULE ]:
3525+ for sample_input in comb [QCOM_SAMPLE_INPUTS ]:
3526+ with self .subTest (i = index ):
3527+ index += 1
3528+ qdq_module = self .get_qdq_module (module , sample_input )
3529+ self .lower_module_and_test_output (qdq_module , sample_input )
3530+
34373531 def test_qnn_backend_einsum_outer_product (self ):
34383532 module = EinsumOuterProduct () # noqa: F405
34393533 x = torch .randn (5 )
0 commit comments