Repository: IntelPython/dpnp

Issue:
Update `dpnp.random` module according OneMKL 2021.4 new additions
## Description
update random module functions according OneMKL 2021.4 new additions


Discussion:

Resolving patch:
diff --git a/dpnp/random/dpnp_iface_random.py b/dpnp/random/dpnp_iface_random.py
--- a/dpnp/random/dpnp_iface_random.py
+++ b/dpnp/random/dpnp_iface_random.py
@@ -125,7 +125,7 @@ def beta(a, b, size=None):
 
     """
 
-    if not use_origin_backend(a) and dpnp_queue_is_cpu():
+    if not use_origin_backend(a):
         # TODO:
         # array_like of floats for `a`, `b`
         if not dpnp.isscalar(a):
@@ -171,7 +171,7 @@ def binomial(n, p, size=None):
 
     """
 
-    if not use_origin_backend(n) and dpnp_queue_is_cpu():
+    if not use_origin_backend(n):
         # TODO:
         # array_like of floats for `p` param
         if not dpnp.isscalar(n):
@@ -225,7 +225,7 @@ def chisquare(df, size=None):
 
     """
 
-    if not use_origin_backend(df) and dpnp_queue_is_cpu():
+    if not use_origin_backend(df):
         # TODO:
         # array_like of floats for `df`
         if not dpnp.isscalar(df):
@@ -364,7 +364,7 @@ def gamma(shape, scale=1.0, size=None):
 
     """
 
-    if not use_origin_backend(scale) and dpnp_queue_is_cpu():
+    if not use_origin_backend(scale):
         # TODO:
         # array_like of floats for `scale` and `shape`
         if not dpnp.isscalar(scale):
@@ -474,7 +474,7 @@ def hypergeometric(ngood, nbad, nsample, size=None):
 
     """
 
-    if not use_origin_backend(ngood) and dpnp_queue_is_cpu():
+    if not use_origin_backend(ngood):
         # TODO:
         # array_like of ints for `ngood`, `nbad`, `nsample` param
         if not dpnp.isscalar(ngood):
@@ -654,7 +654,7 @@ def multinomial(n, pvals, size=None):
 
     """
 
-    if not use_origin_backend(n) and dpnp_queue_is_cpu():
+    if not use_origin_backend(n):
         pvals_sum = sum(pvals)
         d = len(pvals)
         if n < 0:
@@ -702,7 +702,7 @@ def multivariate_normal(mean, cov, size=None, check_valid='warn', tol=1e-8):
 
     """
 
-    if not use_origin_backend(mean) and dpnp_queue_is_cpu():
+    if not use_origin_backend(mean):
         mean_ = numpy.array(mean, dtype=numpy.float64, order='C')
         cov_ = numpy.array(cov, dtype=numpy.float64, order='C')
         if size is None:
@@ -755,7 +755,7 @@ def negative_binomial(n, p, size=None):
 
     """
 
-    if not use_origin_backend(n) and dpnp_queue_is_cpu():
+    if not use_origin_backend(n):
         # TODO:
         # array_like of floats for `p` and `n` params
         if not dpnp.isscalar(n):
@@ -1416,7 +1416,7 @@ def standard_gamma(shape, size=None):
 
     """
 
-    if not use_origin_backend(shape) and dpnp_queue_is_cpu():
+    if not use_origin_backend(shape):
         # TODO:
         # array_like of floats for `shape`
         if not dpnp.isscalar(shape):
@@ -1476,7 +1476,7 @@ def standard_t(df, size=None):
 
     """
 
-    if not use_origin_backend(df) and dpnp_queue_is_cpu():
+    if not use_origin_backend(df):
         # TODO:
         # array_like of floats for `df`
         if not dpnp.isscalar(df):


Test patch:
diff --git a/tests/skipped_tests_gpu.tbl b/tests/skipped_tests_gpu.tbl
--- a/tests/skipped_tests_gpu.tbl
+++ b/tests/skipped_tests_gpu.tbl
@@ -17,6 +17,8 @@ tests/test_random.py::test_check_otput[random_sample]
 tests/test_random.py::test_check_otput[ranf]
 tests/test_random.py::test_check_otput[sample]
 tests/test_random.py::TestDistributionsMultinomial::test_check_sum
+tests/test_random.py::TestDistributionsMultinomial::test_moments
+tests/test_random.py::TestDistributionsMultinomial::test_seed
 tests/test_random.py::TestPermutationsTestShuffle::test_shuffle1[lambda x: dpnp.astype(dpnp.asarray(x), dpnp.int8)]
 tests/test_random.py::TestPermutationsTestShuffle::test_shuffle1[lambda x: dpnp.astype(dpnp.asarray(x), object)]
 tests/test_random.py::TestPermutationsTestShuffle::test_shuffle1[lambda x: dpnp.vstack([x, x]).T]
@@ -178,20 +180,6 @@ tests/test_linalg.py::test_qr[(16,16)-float32]
 tests/test_linalg.py::test_qr[(16,16)-int64]
 tests/test_linalg.py::test_qr[(16,16)-int32]
 tests/test_random.py::test_randn_normal_distribution
-tests/test_random.py::TestDistributionsBeta::test_moments
-tests/test_random.py::TestDistributionsBinomial::test_moments
-tests/test_random.py::TestDistributionsF::test_moments
-tests/test_random.py::TestDistributionsGamma::test_moments
-tests/test_random.py::TestDistributionsGeometric::test_moments
-tests/test_random.py::TestDistributionsGumbel::test_moments
-tests/test_random.py::TestDistributionsHypergeometric::test_moments
-tests/test_random.py::TestDistributionsLaplace::test_moments
-tests/test_random.py::TestDistributionsLogistic::test_moments
-tests/test_random.py::TestDistributionsLognormal::test_moments
-tests/test_random.py::TestDistributionsMultinomial::test_moments
-tests/test_random.py::TestDistributionsMultivariateNormal::test_moments
-tests/test_random.py::TestDistributionsNormal::test_moments
-tests/test_random.py::TestDistributionsNoncentralChisquare::test_moments[df_grt_1]
 tests/third_party/cupy/linalg_tests/test_product.py::TestProduct::test_multidim_outer
 tests/third_party/cupy/random_tests/test_sample.py::TestRandintDtype::test_dtype
 tests/third_party/cupy/random_tests/test_sample.py::TestRandintDtype::test_dtype2
diff --git a/tests/test_random.py b/tests/test_random.py
--- a/tests/test_random.py
+++ b/tests/test_random.py
@@ -495,7 +495,7 @@ def test_check_sum(self):
         pvals = [1 / 6.] * 6
         dpnp.random.seed(seed)
         res = dpnp.random.multinomial(n, pvals, size)
-        assert_allclose(n, sum(res), rtol=1e-07, atol=0)
+        assert_allclose(n, dpnp.asnumpy(res).sum(), rtol=1e-07, atol=0)
 
     def test_invalid_args(self):
         n = -10                # parameter `n`, non-negative expected
@@ -511,6 +511,14 @@ def test_seed(self):
         self.check_seed('multinomial', {'n': n, 'pvals': pvals})
 
 
+    def test_seed1(self):
+        # pvals_size >= ntrial * 16 && ntrial <= 16
+        n = 4
+        pvals_size = 16 * n
+        pvals = [1 / pvals_size] * pvals_size
+        self.check_seed('multinomial', {'n': n, 'pvals': pvals})
+
+
 class TestDistributionsMultivariateNormal(TestDistribution):
 
     def test_moments(self):