Skip to content

Commit a61cce9

Browse files
FIX: random.beta fallback (#355)
* update fallback
1 parent 299814c commit a61cce9

File tree

1 file changed

+14
-36
lines changed

1 file changed

+14
-36
lines changed

dpnp/random/dpnp_iface_random.py

Lines changed: 14 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -101,48 +101,26 @@ def beta(a, b, size=None):
101101
102102
Draw samples from a Beta distribution.
103103
104-
The Beta distribution is a special case of the Dirichlet distribution,
105-
and is related to the Gamma distribution. It has the probability
106-
distribution function
104+
For full documentation refer to :obj:`numpy.random.beta`.
107105
108-
.. math:: f(x; a,b) = \\frac{1}{B(\\alpha, \\beta)} x^{\\alpha - 1}
109-
(1 - x)^{\\beta - 1},
110-
111-
where the normalization, B, is the beta function,
112-
113-
.. math:: B(\\alpha, \\beta) = \\int_0^1 t^{\\alpha - 1}
114-
(1 - t)^{\\beta - 1} dt.
115-
116-
It is often seen in Bayesian inference and order statistics.
117-
118-
Parameters
119-
----------
120-
a : float
121-
Alpha, positive (>0).
122-
b : float
123-
Beta, positive (>0).
124-
size : int or tuple of ints, optional
125-
Output shape. If the given shape is, e.g., ``(m, n, k)``, then
126-
``m * n * k`` samples are drawn. If size is ``None`` (default),
127-
a single value is returned if ``a`` and ``b`` are both scalars.
106+
Limitations
107+
-----------
108+
Parameters ``a`` and ``b`` are supported as scalar.
109+
Otherwise, :obj:`numpy.random.beta(a, b, size)` samples are drawn.
110+
Output array data type is :obj:`dpnp.float64`.
128111
129-
Returns
130-
-------
131-
out : dparray
132-
Drawn samples from the parameterized beta distribution.
112+
Examples
113+
--------
114+
Draw samples from the distribution:
115+
>>> a, b = .4, .5 # alpha, beta
116+
>>> s = dpnp.random.beta(a, b, 1000)
133117
134118
"""
135119

136-
# TODO:
137-
# array_like of floats for `a`, `b`
138120
if not use_origin_backend(a) and dpnp_queue_is_cpu():
139-
if isinstance(size, tuple):
140-
for dim in size:
141-
if not isinstance(dim, int):
142-
pass
143-
elif not isinstance(size, int):
144-
pass
145-
elif not dpnp.isscalar(a):
121+
# TODO:
122+
# array_like of floats for `a`, `b`
123+
if not dpnp.isscalar(a):
146124
pass
147125
elif not dpnp.isscalar(b):
148126
pass

0 commit comments

Comments
 (0)