Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
165 changes: 0 additions & 165 deletions dpnp/random/dpnp_iface_random.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,15 +422,6 @@ def exponential(scale=1.0, size=None):
"""

if not use_origin_backend(scale):
if size is None:
size = 1
elif isinstance(size, tuple):
for dim in size:
if not isinstance(dim, int):
checker_throw_value_error("exponential", "type(dim)", type(dim), int)
elif not isinstance(size, int):
checker_throw_value_error("exponential", "type(size)", type(size), int)

if scale < 0:
checker_throw_value_error("exponential", "scale", scale, "non-negative")

Expand Down Expand Up @@ -508,15 +499,6 @@ def gamma(shape, scale=1.0, size=None):
# TODO:
# array_like of floats for `scale` and `shape`
if not use_origin_backend(scale) and dpnp_queue_is_cpu():
if size is None:
size = 1
elif isinstance(size, tuple):
for dim in size:
if not isinstance(dim, int):
checker_throw_value_error("gamma", "type(dim)", type(dim), int)
elif not isinstance(size, int):
checker_throw_value_error("gamma", "type(size)", type(size), int)

if scale < 0:
checker_throw_value_error("gamma", "scale", scale, "non-negative")
if shape < 0:
Expand Down Expand Up @@ -567,15 +549,6 @@ def geometric(p, size=None):
"""

if not use_origin_backend(p):
if size is None:
size = 1
elif isinstance(size, tuple):
for dim in size:
if not isinstance(dim, int):
checker_throw_value_error("geometric", "type(dim)", type(dim), int)
elif not isinstance(size, int):
checker_throw_value_error("geometric", "type(size)", type(size), int)

# TODO:
# array_like of floats for `p` param
if p > 1 or p <= 0:
Expand Down Expand Up @@ -620,15 +593,6 @@ def gumbel(loc=0.0, scale=1.0, size=None):
"""

if not use_origin_backend(loc):
if size is None:
size = 1
elif isinstance(size, tuple):
for dim in size:
if not isinstance(dim, int):
checker_throw_value_error("gumbel", "type(dim)", type(dim), int)
elif not isinstance(size, int):
checker_throw_value_error("gumbel", "type(size)", type(size), int)

# TODO:
# array_like of floats for `loc` and `scale` params
if scale < 0:
Expand Down Expand Up @@ -713,15 +677,6 @@ def hypergeometric(ngood, nbad, nsample, size=None):
"""

if not use_origin_backend(ngood) and dpnp_queue_is_cpu():
if size is None:
size = 1
elif isinstance(size, tuple):
for dim in size:
if not isinstance(dim, int):
checker_throw_value_error("hypergeometric", "type(dim)", type(dim), int)
elif not isinstance(size, int):
checker_throw_value_error("hypergeometric", "type(size)", type(size), int)

# TODO:
# array_like of ints for `ngood`, `nbad`, `nsample` param
if ngood < 0:
Expand Down Expand Up @@ -780,15 +735,6 @@ def laplace(loc=0.0, scale=1.0, size=None):
"""

if not use_origin_backend(loc):
if size is None:
size = 1
elif isinstance(size, tuple):
for dim in size:
if not isinstance(dim, int):
checker_throw_value_error("laplace", "type(dim)", type(dim), int)
elif not isinstance(size, int):
checker_throw_value_error("laplace", "type(size)", type(size), int)

# TODO:
# array_like of floats for `loc` and `scale` params
if scale < 0:
Expand Down Expand Up @@ -878,15 +824,6 @@ def lognormal(mean=0.0, sigma=1.0, size=None):
"""

if not use_origin_backend(mean):
if size is None:
size = 1
elif isinstance(size, tuple):
for dim in size:
if not isinstance(dim, int):
checker_throw_value_error("lognormal", "type(dim)", type(dim), int)
elif not isinstance(size, int):
checker_throw_value_error("lognormal", "type(size)", type(size), int)

# TODO:
# array_like of floats for `mean` and `sigma` params
if sigma < 0:
Expand Down Expand Up @@ -1172,15 +1109,6 @@ def negative_binomial(n, p, size=None):
"""

if not use_origin_backend(n) and dpnp_queue_is_cpu():
if size is None:
size = 1
elif isinstance(size, tuple):
for dim in size:
if not isinstance(dim, int):
checker_throw_value_error("negative_binomial", "type(dim)", type(dim), int)
elif not isinstance(size, int):
checker_throw_value_error("negative_binomial", "type(size)", type(size), int)

# TODO:
# array_like of floats for `p` and `n` params
if p > 1 or p < 0:
Expand Down Expand Up @@ -1259,15 +1187,6 @@ def normal(loc=0.0, scale=1.0, size=None):
"""

if not use_origin_backend(loc):
if size is None:
size = 1
elif isinstance(size, tuple):
for dim in size:
if not isinstance(dim, int):
checker_throw_value_error("normal", "type(dim)", type(dim), int)
elif not isinstance(size, int):
checker_throw_value_error("normal", "type(size)", type(size), int)

# TODO:
# array_like of floats for `loc` and `scale` params
if scale < 0:
Expand Down Expand Up @@ -1396,15 +1315,6 @@ def poisson(lam=1.0, size=None):
"""

if not use_origin_backend(lam):
if size is None:
size = 1
elif isinstance(size, tuple):
for dim in size:
if not isinstance(dim, int):
checker_throw_value_error("poisson", "type(dim)", type(dim), int)
elif not isinstance(size, int):
checker_throw_value_error("poisson", "type(size)", type(size), int)

# TODO:
# array_like of floats for `lam` param
if lam < 0:
Expand Down Expand Up @@ -1504,15 +1414,6 @@ def randint(low, high=None, size=None, dtype=int):
"""

if not use_origin_backend(low):
if size is None:
size = 1
elif isinstance(size, tuple):
for dim in size:
if not isinstance(dim, int):
checker_throw_value_error("randint", "type(dim)", type(dim), int)
elif not isinstance(size, int):
checker_throw_value_error("randint", "type(size)", type(size), int)

if high is None:
high = low
low = 0
Expand Down Expand Up @@ -1659,9 +1560,6 @@ def random_sample(size):
"""

if not use_origin_backend(size):
for dim in size:
if not isinstance(dim, int):
checker_throw_value_error("random_sample", "type(dim)", type(dim), int)
return dpnp_random(size)

return call_origin(numpy.random.random_sample, size)
Expand All @@ -1687,9 +1585,6 @@ def ranf(size):
"""

if not use_origin_backend(size):
for dim in size:
if not isinstance(dim, int):
checker_throw_value_error("ranf", "type(dim)", type(dim), int)
return dpnp_random(size)

return call_origin(numpy.random.ranf, size)
Expand Down Expand Up @@ -1720,15 +1615,6 @@ def rayleigh(scale=1.0, size=None):
"""

if not use_origin_backend(scale):
if size is None:
size = 1
elif isinstance(size, tuple):
for dim in size:
if not isinstance(dim, int):
checker_throw_value_error("rayleigh", "type(dim)", type(dim), int)
elif not isinstance(size, int):
checker_throw_value_error("rayleigh", "type(size)", type(size), int)

# TODO:
# array_like of floats for `scale` params
if scale < 0:
Expand Down Expand Up @@ -1759,9 +1645,6 @@ def sample(size):
"""

if not use_origin_backend(size):
for dim in size:
if not isinstance(dim, int):
checker_throw_value_error("sample", "type(dim)", type(dim), int)
return dpnp_random(size)

return call_origin(numpy.random.sample, size)
Expand Down Expand Up @@ -1836,15 +1719,6 @@ def standard_cauchy(size=None):
"""

if not use_origin_backend(size):
if size is None:
size = 1
elif isinstance(size, tuple):
for dim in size:
if not isinstance(dim, int):
checker_throw_value_error("standard_cauchy", "type(dim)", type(dim), int)
elif not isinstance(size, int):
checker_throw_value_error("standard_cauchy", "type(size)", type(size), int)

return dpnp_standard_cauchy(size)

return call_origin(numpy.random.standard_cauchy, size)
Expand Down Expand Up @@ -1878,15 +1752,6 @@ def standard_exponential(size=None):
"""

if not use_origin_backend(size):
if size is None:
size = 1
elif isinstance(size, tuple):
for dim in size:
if not isinstance(dim, int):
checker_throw_value_error("standard_exponential", "type(dim)", type(dim), int)
elif not isinstance(size, int):
checker_throw_value_error("standard_exponential", "type(size)", type(size), int)

return dpnp_standard_exponential(size)

return call_origin(numpy.random.standard_exponential, size)
Expand Down Expand Up @@ -1946,15 +1811,6 @@ def standard_gamma(shape, size=None):
# TODO:
# array_like of floats for and `shape`
if not use_origin_backend(shape) and dpnp_queue_is_cpu():
if size is None:
size = 1
elif isinstance(size, tuple):
for dim in size:
if not isinstance(dim, int):
checker_throw_value_error("standard_gamma", "type(dim)", type(dim), int)
elif not isinstance(size, int):
checker_throw_value_error("standard_gamma", "type(size)", type(size), int)

if shape < 0:
checker_throw_value_error("standard_gamma", "shape", shape, "non-negative")

Expand Down Expand Up @@ -1984,15 +1840,6 @@ def standard_normal(size=None):
"""

if not use_origin_backend(size):
if size is None:
size = 1
elif isinstance(size, tuple):
for dim in size:
if not isinstance(dim, int):
checker_throw_value_error("standard_normal", "type(dim)", type(dim), int)
elif not isinstance(size, int):
checker_throw_value_error("standard_normal", "type(size)", type(size), int)

return dpnp_standard_normal(size)

return call_origin(numpy.random.standard_normal, size)
Expand Down Expand Up @@ -2069,8 +1916,6 @@ def uniform(low=0.0, high=1.0, size=None):
"""

if not use_origin_backend(low):
if size is None:
size = 1
if low == high:
# TODO:
# currently dparray.full is not implemented
Expand Down Expand Up @@ -2155,20 +2000,10 @@ def weibull(a, size=None):
"""

if not use_origin_backend(a):
if size is None:
size = 1
elif isinstance(size, tuple):
for dim in size:
if not isinstance(dim, int):
checker_throw_value_error("weibull", "type(dim)", type(dim), int)
elif not isinstance(size, int):
checker_throw_value_error("weibull", "type(size)", type(size), int)

# TODO:
# array_like of floats for `a` params
if a < 0:
checker_throw_value_error("weibulla", "a", a, "non-negative")

return dpnp_weibull(a, size)

return call_origin(numpy.random.weibull, a, size)
Expand Down