@@ -596,120 +596,131 @@ def test_gradient_y1_dx(self, array, dx):
596
596
assert_array_equal (expected , result )
597
597
598
598
599
+ if has_support_aspect64 ():
600
+ dtype_list = [numpy .float32 , numpy .int64 , numpy .int32 ]
601
+ ids_list = ["numpy.float32" , "numpy.int64" , "numpy.int32" ]
602
+ else :
603
+ dtype_list = [numpy .int64 , numpy .int32 ]
604
+ ids_list = ["numpy.int64" , "numpy.int32" ]
605
+
606
+
599
607
class TestCeil :
600
608
def test_ceil (self ):
601
609
array_data = numpy .arange (10 )
602
- out = numpy .empty (10 , dtype = numpy .float64 )
610
+ out = numpy .empty (10 , dtype = numpy .float32 )
603
611
604
612
# DPNP
605
- dp_array = dpnp .array (array_data , dtype = dpnp .float64 )
606
- dp_out = dpnp .array (out , dtype = dpnp .float64 )
613
+ dp_array = dpnp .array (array_data , dtype = dpnp .float32 )
614
+ dp_out = dpnp .array (out , dtype = dpnp .float32 )
607
615
result = dpnp .ceil (dp_array , out = dp_out )
608
616
609
617
# original
610
- np_array = numpy .array (array_data , dtype = numpy .float64 )
618
+ np_array = numpy .array (array_data , dtype = numpy .float32 )
611
619
expected = numpy .ceil (np_array , out = out )
612
620
613
621
assert_array_equal (expected , result )
614
622
615
623
@pytest .mark .parametrize (
616
624
"dtype" ,
617
- [ numpy . float32 , numpy . int64 , numpy . int32 ] ,
618
- ids = [ "numpy.float32" , "numpy.int64" , "numpy.int32" ] ,
625
+ dtype_list ,
626
+ ids = ids_list ,
619
627
)
620
628
def test_invalid_dtype (self , dtype ):
621
- dp_array = dpnp .arange (10 , dtype = dpnp .float64 )
629
+ dpnp_dtype = dpnp .float64 if has_support_aspect64 () else dpnp .float32
630
+ dp_array = dpnp .arange (10 , dtype = dpnp_dtype )
622
631
dp_out = dpnp .empty (10 , dtype = dtype )
623
632
624
- with pytest .raises (ValueError ):
633
+ with pytest .raises (TypeError ):
625
634
dpnp .ceil (dp_array , out = dp_out )
626
635
627
636
@pytest .mark .parametrize (
628
637
"shape" , [(0 ,), (15 ,), (2 , 2 )], ids = ["(0,)" , "(15, )" , "(2,2)" ]
629
638
)
630
639
def test_invalid_shape (self , shape ):
631
- dp_array = dpnp .arange (10 , dtype = dpnp .float64 )
632
- dp_out = dpnp .empty (shape , dtype = dpnp .float64 )
640
+ dp_array = dpnp .arange (10 , dtype = dpnp .float32 )
641
+ dp_out = dpnp .empty (shape , dtype = dpnp .float32 )
633
642
634
- with pytest .raises (ValueError ):
643
+ with pytest .raises (TypeError ):
635
644
dpnp .ceil (dp_array , out = dp_out )
636
645
637
646
638
647
class TestFloor :
639
648
def test_floor (self ):
640
649
array_data = numpy .arange (10 )
641
- out = numpy .empty (10 , dtype = numpy .float64 )
650
+ out = numpy .empty (10 , dtype = numpy .float32 )
642
651
643
652
# DPNP
644
- dp_array = dpnp .array (array_data , dtype = dpnp .float64 )
645
- dp_out = dpnp .array (out , dtype = dpnp .float64 )
653
+ dp_array = dpnp .array (array_data , dtype = dpnp .float32 )
654
+ dp_out = dpnp .array (out , dtype = dpnp .float32 )
646
655
result = dpnp .floor (dp_array , out = dp_out )
647
656
648
657
# original
649
- np_array = numpy .array (array_data , dtype = numpy .float64 )
658
+ np_array = numpy .array (array_data , dtype = numpy .float32 )
650
659
expected = numpy .floor (np_array , out = out )
651
660
652
661
assert_array_equal (expected , result )
653
662
654
663
@pytest .mark .parametrize (
655
664
"dtype" ,
656
- [ numpy . float32 , numpy . int64 , numpy . int32 ] ,
657
- ids = [ "numpy.float32" , "numpy.int64" , "numpy.int32" ] ,
665
+ dtype_list ,
666
+ ids = ids_list ,
658
667
)
659
668
def test_invalid_dtype (self , dtype ):
660
- dp_array = dpnp .arange (10 , dtype = dpnp .float64 )
669
+ dpnp_dtype = dpnp .float64 if has_support_aspect64 () else dpnp .float32
670
+ dp_array = dpnp .arange (10 , dtype = dpnp_dtype )
661
671
dp_out = dpnp .empty (10 , dtype = dtype )
662
672
663
- with pytest .raises (ValueError ):
673
+ with pytest .raises (TypeError ):
664
674
dpnp .floor (dp_array , out = dp_out )
665
675
666
676
@pytest .mark .parametrize (
667
677
"shape" , [(0 ,), (15 ,), (2 , 2 )], ids = ["(0,)" , "(15, )" , "(2,2)" ]
668
678
)
669
679
def test_invalid_shape (self , shape ):
670
- dp_array = dpnp .arange (10 , dtype = dpnp .float64 )
671
- dp_out = dpnp .empty (shape , dtype = dpnp .float64 )
680
+ dp_array = dpnp .arange (10 , dtype = dpnp .float32 )
681
+ dp_out = dpnp .empty (shape , dtype = dpnp .float32 )
672
682
673
- with pytest .raises (ValueError ):
683
+ with pytest .raises (TypeError ):
674
684
dpnp .floor (dp_array , out = dp_out )
675
685
676
686
677
687
class TestTrunc :
678
688
def test_trunc (self ):
679
689
array_data = numpy .arange (10 )
680
- out = numpy .empty (10 , dtype = numpy .float64 )
690
+ out = numpy .empty (10 , dtype = numpy .float32 )
681
691
682
692
# DPNP
683
- dp_array = dpnp .array (array_data , dtype = dpnp .float64 )
684
- dp_out = dpnp .array (out , dtype = dpnp .float64 )
693
+ dp_array = dpnp .array (array_data , dtype = dpnp .float32 )
694
+ dp_out = dpnp .array (out , dtype = dpnp .float32 )
685
695
result = dpnp .trunc (dp_array , out = dp_out )
686
696
687
697
# original
688
- np_array = numpy .array (array_data , dtype = numpy .float64 )
698
+ np_array = numpy .array (array_data , dtype = numpy .float32 )
689
699
expected = numpy .trunc (np_array , out = out )
690
700
691
701
assert_array_equal (expected , result )
692
702
693
703
@pytest .mark .parametrize (
694
704
"dtype" ,
695
- [ numpy . float32 , numpy . int64 , numpy . int32 ] ,
696
- ids = [ "numpy.float32" , "numpy.int64" , "numpy.int32" ] ,
705
+ dtype_list ,
706
+ ids = ids_list ,
697
707
)
698
708
def test_invalid_dtype (self , dtype ):
699
- dp_array = dpnp .arange (10 , dtype = dpnp .float64 )
709
+ dpnp_dtype = dpnp .float64 if has_support_aspect64 () else dpnp .float32
710
+ dp_array = dpnp .arange (10 , dtype = dpnp_dtype )
700
711
dp_out = dpnp .empty (10 , dtype = dtype )
701
712
702
- with pytest .raises (ValueError ):
713
+ with pytest .raises (TypeError ):
703
714
dpnp .trunc (dp_array , out = dp_out )
704
715
705
716
@pytest .mark .parametrize (
706
717
"shape" , [(0 ,), (15 ,), (2 , 2 )], ids = ["(0,)" , "(15, )" , "(2,2)" ]
707
718
)
708
719
def test_invalid_shape (self , shape ):
709
- dp_array = dpnp .arange (10 , dtype = dpnp .float64 )
710
- dp_out = dpnp .empty (shape , dtype = dpnp .float64 )
720
+ dp_array = dpnp .arange (10 , dtype = dpnp .float32 )
721
+ dp_out = dpnp .empty (shape , dtype = dpnp .float32 )
711
722
712
- with pytest .raises (ValueError ):
723
+ with pytest .raises (TypeError ):
713
724
dpnp .trunc (dp_array , out = dp_out )
714
725
715
726
0 commit comments