@@ -327,15 +327,6 @@ def exponential(scale=1.0, size=None):
327
327
"""
328
328
329
329
if not use_origin_backend (scale ):
330
- if size is None :
331
- size = 1
332
- elif isinstance (size , tuple ):
333
- for dim in size :
334
- if not isinstance (dim , int ):
335
- checker_throw_value_error ("exponential" , "type(dim)" , type (dim ), int )
336
- elif not isinstance (size , int ):
337
- checker_throw_value_error ("exponential" , "type(size)" , type (size ), int )
338
-
339
330
if scale < 0 :
340
331
checker_throw_value_error ("exponential" , "scale" , scale , "non-negative" )
341
332
@@ -413,15 +404,6 @@ def gamma(shape, scale=1.0, size=None):
413
404
# TODO:
414
405
# array_like of floats for `scale` and `shape`
415
406
if not use_origin_backend (scale ) and dpnp_queue_is_cpu ():
416
- if size is None :
417
- size = 1
418
- elif isinstance (size , tuple ):
419
- for dim in size :
420
- if not isinstance (dim , int ):
421
- checker_throw_value_error ("gamma" , "type(dim)" , type (dim ), int )
422
- elif not isinstance (size , int ):
423
- checker_throw_value_error ("gamma" , "type(size)" , type (size ), int )
424
-
425
407
if scale < 0 :
426
408
checker_throw_value_error ("gamma" , "scale" , scale , "non-negative" )
427
409
if shape < 0 :
@@ -472,15 +454,6 @@ def geometric(p, size=None):
472
454
"""
473
455
474
456
if not use_origin_backend (p ):
475
- if size is None :
476
- size = 1
477
- elif isinstance (size , tuple ):
478
- for dim in size :
479
- if not isinstance (dim , int ):
480
- checker_throw_value_error ("geometric" , "type(dim)" , type (dim ), int )
481
- elif not isinstance (size , int ):
482
- checker_throw_value_error ("geometric" , "type(size)" , type (size ), int )
483
-
484
457
# TODO:
485
458
# array_like of floats for `p` param
486
459
if p > 1 or p <= 0 :
@@ -525,15 +498,6 @@ def gumbel(loc=0.0, scale=1.0, size=None):
525
498
"""
526
499
527
500
if not use_origin_backend (loc ):
528
- if size is None :
529
- size = 1
530
- elif isinstance (size , tuple ):
531
- for dim in size :
532
- if not isinstance (dim , int ):
533
- checker_throw_value_error ("gumbel" , "type(dim)" , type (dim ), int )
534
- elif not isinstance (size , int ):
535
- checker_throw_value_error ("gumbel" , "type(size)" , type (size ), int )
536
-
537
501
# TODO:
538
502
# array_like of floats for `loc` and `scale` params
539
503
if scale < 0 :
@@ -618,15 +582,6 @@ def hypergeometric(ngood, nbad, nsample, size=None):
618
582
"""
619
583
620
584
if not use_origin_backend (ngood ) and dpnp_queue_is_cpu ():
621
- if size is None :
622
- size = 1
623
- elif isinstance (size , tuple ):
624
- for dim in size :
625
- if not isinstance (dim , int ):
626
- checker_throw_value_error ("hypergeometric" , "type(dim)" , type (dim ), int )
627
- elif not isinstance (size , int ):
628
- checker_throw_value_error ("hypergeometric" , "type(size)" , type (size ), int )
629
-
630
585
# TODO:
631
586
# array_like of ints for `ngood`, `nbad`, `nsample` param
632
587
if ngood < 0 :
@@ -685,15 +640,6 @@ def laplace(loc=0.0, scale=1.0, size=None):
685
640
"""
686
641
687
642
if not use_origin_backend (loc ):
688
- if size is None :
689
- size = 1
690
- elif isinstance (size , tuple ):
691
- for dim in size :
692
- if not isinstance (dim , int ):
693
- checker_throw_value_error ("laplace" , "type(dim)" , type (dim ), int )
694
- elif not isinstance (size , int ):
695
- checker_throw_value_error ("laplace" , "type(size)" , type (size ), int )
696
-
697
643
# TODO:
698
644
# array_like of floats for `loc` and `scale` params
699
645
if scale < 0 :
@@ -783,15 +729,6 @@ def lognormal(mean=0.0, sigma=1.0, size=None):
783
729
"""
784
730
785
731
if not use_origin_backend (mean ):
786
- if size is None :
787
- size = 1
788
- elif isinstance (size , tuple ):
789
- for dim in size :
790
- if not isinstance (dim , int ):
791
- checker_throw_value_error ("lognormal" , "type(dim)" , type (dim ), int )
792
- elif not isinstance (size , int ):
793
- checker_throw_value_error ("lognormal" , "type(size)" , type (size ), int )
794
-
795
732
# TODO:
796
733
# array_like of floats for `mean` and `sigma` params
797
734
if sigma < 0 :
@@ -1077,15 +1014,6 @@ def negative_binomial(n, p, size=None):
1077
1014
"""
1078
1015
1079
1016
if not use_origin_backend (n ) and dpnp_queue_is_cpu ():
1080
- if size is None :
1081
- size = 1
1082
- elif isinstance (size , tuple ):
1083
- for dim in size :
1084
- if not isinstance (dim , int ):
1085
- checker_throw_value_error ("negative_binomial" , "type(dim)" , type (dim ), int )
1086
- elif not isinstance (size , int ):
1087
- checker_throw_value_error ("negative_binomial" , "type(size)" , type (size ), int )
1088
-
1089
1017
# TODO:
1090
1018
# array_like of floats for `p` and `n` params
1091
1019
if p > 1 or p < 0 :
@@ -1164,15 +1092,6 @@ def normal(loc=0.0, scale=1.0, size=None):
1164
1092
"""
1165
1093
1166
1094
if not use_origin_backend (loc ):
1167
- if size is None :
1168
- size = 1
1169
- elif isinstance (size , tuple ):
1170
- for dim in size :
1171
- if not isinstance (dim , int ):
1172
- checker_throw_value_error ("normal" , "type(dim)" , type (dim ), int )
1173
- elif not isinstance (size , int ):
1174
- checker_throw_value_error ("normal" , "type(size)" , type (size ), int )
1175
-
1176
1095
# TODO:
1177
1096
# array_like of floats for `loc` and `scale` params
1178
1097
if scale < 0 :
@@ -1301,15 +1220,6 @@ def poisson(lam=1.0, size=None):
1301
1220
"""
1302
1221
1303
1222
if not use_origin_backend (lam ):
1304
- if size is None :
1305
- size = 1
1306
- elif isinstance (size , tuple ):
1307
- for dim in size :
1308
- if not isinstance (dim , int ):
1309
- checker_throw_value_error ("poisson" , "type(dim)" , type (dim ), int )
1310
- elif not isinstance (size , int ):
1311
- checker_throw_value_error ("poisson" , "type(size)" , type (size ), int )
1312
-
1313
1223
# TODO:
1314
1224
# array_like of floats for `lam` param
1315
1225
if lam < 0 :
@@ -1409,15 +1319,6 @@ def randint(low, high=None, size=None, dtype=int):
1409
1319
"""
1410
1320
1411
1321
if not use_origin_backend (low ):
1412
- if size is None :
1413
- size = 1
1414
- elif isinstance (size , tuple ):
1415
- for dim in size :
1416
- if not isinstance (dim , int ):
1417
- checker_throw_value_error ("randint" , "type(dim)" , type (dim ), int )
1418
- elif not isinstance (size , int ):
1419
- checker_throw_value_error ("randint" , "type(size)" , type (size ), int )
1420
-
1421
1322
if high is None :
1422
1323
high = low
1423
1324
low = 0
@@ -1564,9 +1465,6 @@ def random_sample(size):
1564
1465
"""
1565
1466
1566
1467
if not use_origin_backend (size ):
1567
- for dim in size :
1568
- if not isinstance (dim , int ):
1569
- checker_throw_value_error ("random_sample" , "type(dim)" , type (dim ), int )
1570
1468
return dpnp_random (size )
1571
1469
1572
1470
return call_origin (numpy .random .random_sample , size )
@@ -1592,9 +1490,6 @@ def ranf(size):
1592
1490
"""
1593
1491
1594
1492
if not use_origin_backend (size ):
1595
- for dim in size :
1596
- if not isinstance (dim , int ):
1597
- checker_throw_value_error ("ranf" , "type(dim)" , type (dim ), int )
1598
1493
return dpnp_random (size )
1599
1494
1600
1495
return call_origin (numpy .random .ranf , size )
@@ -1625,15 +1520,6 @@ def rayleigh(scale=1.0, size=None):
1625
1520
"""
1626
1521
1627
1522
if not use_origin_backend (scale ):
1628
- if size is None :
1629
- size = 1
1630
- elif isinstance (size , tuple ):
1631
- for dim in size :
1632
- if not isinstance (dim , int ):
1633
- checker_throw_value_error ("rayleigh" , "type(dim)" , type (dim ), int )
1634
- elif not isinstance (size , int ):
1635
- checker_throw_value_error ("rayleigh" , "type(size)" , type (size ), int )
1636
-
1637
1523
# TODO:
1638
1524
# array_like of floats for `scale` params
1639
1525
if scale < 0 :
@@ -1664,9 +1550,6 @@ def sample(size):
1664
1550
"""
1665
1551
1666
1552
if not use_origin_backend (size ):
1667
- for dim in size :
1668
- if not isinstance (dim , int ):
1669
- checker_throw_value_error ("sample" , "type(dim)" , type (dim ), int )
1670
1553
return dpnp_random (size )
1671
1554
1672
1555
return call_origin (numpy .random .sample , size )
@@ -1741,15 +1624,6 @@ def standard_cauchy(size=None):
1741
1624
"""
1742
1625
1743
1626
if not use_origin_backend (size ):
1744
- if size is None :
1745
- size = 1
1746
- elif isinstance (size , tuple ):
1747
- for dim in size :
1748
- if not isinstance (dim , int ):
1749
- checker_throw_value_error ("standard_cauchy" , "type(dim)" , type (dim ), int )
1750
- elif not isinstance (size , int ):
1751
- checker_throw_value_error ("standard_cauchy" , "type(size)" , type (size ), int )
1752
-
1753
1627
return dpnp_standard_cauchy (size )
1754
1628
1755
1629
return call_origin (numpy .random .standard_cauchy , size )
@@ -1783,15 +1657,6 @@ def standard_exponential(size=None):
1783
1657
"""
1784
1658
1785
1659
if not use_origin_backend (size ):
1786
- if size is None :
1787
- size = 1
1788
- elif isinstance (size , tuple ):
1789
- for dim in size :
1790
- if not isinstance (dim , int ):
1791
- checker_throw_value_error ("standard_exponential" , "type(dim)" , type (dim ), int )
1792
- elif not isinstance (size , int ):
1793
- checker_throw_value_error ("standard_exponential" , "type(size)" , type (size ), int )
1794
-
1795
1660
return dpnp_standard_exponential (size )
1796
1661
1797
1662
return call_origin (numpy .random .standard_exponential , size )
@@ -1851,15 +1716,6 @@ def standard_gamma(shape, size=None):
1851
1716
# TODO:
1852
1717
# array_like of floats for and `shape`
1853
1718
if not use_origin_backend (shape ) and dpnp_queue_is_cpu ():
1854
- if size is None :
1855
- size = 1
1856
- elif isinstance (size , tuple ):
1857
- for dim in size :
1858
- if not isinstance (dim , int ):
1859
- checker_throw_value_error ("standard_gamma" , "type(dim)" , type (dim ), int )
1860
- elif not isinstance (size , int ):
1861
- checker_throw_value_error ("standard_gamma" , "type(size)" , type (size ), int )
1862
-
1863
1719
if shape < 0 :
1864
1720
checker_throw_value_error ("standard_gamma" , "shape" , shape , "non-negative" )
1865
1721
@@ -1889,15 +1745,6 @@ def standard_normal(size=None):
1889
1745
"""
1890
1746
1891
1747
if not use_origin_backend (size ):
1892
- if size is None :
1893
- size = 1
1894
- elif isinstance (size , tuple ):
1895
- for dim in size :
1896
- if not isinstance (dim , int ):
1897
- checker_throw_value_error ("standard_normal" , "type(dim)" , type (dim ), int )
1898
- elif not isinstance (size , int ):
1899
- checker_throw_value_error ("standard_normal" , "type(size)" , type (size ), int )
1900
-
1901
1748
return dpnp_standard_normal (size )
1902
1749
1903
1750
return call_origin (numpy .random .standard_normal , size )
@@ -1974,8 +1821,6 @@ def uniform(low=0.0, high=1.0, size=None):
1974
1821
"""
1975
1822
1976
1823
if not use_origin_backend (low ):
1977
- if size is None :
1978
- size = 1
1979
1824
if low == high :
1980
1825
# TODO:
1981
1826
# currently dparray.full is not implemented
@@ -2060,20 +1905,10 @@ def weibull(a, size=None):
2060
1905
"""
2061
1906
2062
1907
if not use_origin_backend (a ):
2063
- if size is None :
2064
- size = 1
2065
- elif isinstance (size , tuple ):
2066
- for dim in size :
2067
- if not isinstance (dim , int ):
2068
- checker_throw_value_error ("weibull" , "type(dim)" , type (dim ), int )
2069
- elif not isinstance (size , int ):
2070
- checker_throw_value_error ("weibull" , "type(size)" , type (size ), int )
2071
-
2072
1908
# TODO:
2073
1909
# array_like of floats for `a` params
2074
1910
if a < 0 :
2075
1911
checker_throw_value_error ("weibulla" , "a" , a , "non-negative" )
2076
-
2077
1912
return dpnp_weibull (a , size )
2078
1913
2079
1914
return call_origin (numpy .random .weibull , a , size )
0 commit comments