Repository navigation
Add continuous distributions to dpnp.random.Generator - #3158
ndgrigorian wants to merge 12 commits into
Conversation
dbdb2c8 to
3963d20
Compare
0160558 to
adf7178
Compare
3963d20 to
6c3ff46
Compare
|
Array API standard conformance tests for dpnp=0.22.0dev2=np2py314h8d9cdd5_48 ran successfully. |
9fef498 to
1bd3cee
Compare
adf7178 to
cfa00bd
Compare
|
View rendered docs @ https://intelpython.github.io/dpnp/pull/3158/index.html |
df5cb09 to
7c8127b
Compare
9f9f13e to
88c286e
Compare
|
Comments on lines outside the diff:
|
88c286e to
ef331fa
Compare
7c8127b to
9ed9f9a
Compare
78535ba to
6317de6
Compare
antonwolfy
left a comment
There was a problem hiding this comment.
Docs of the continuous distributions checked against NumPy 2.5.5: every method links to NumPy's page and states NumPy's parameter constraints. Only the two Raises sections below are missing.
vlad-perevezentsev
left a comment
There was a problem hiding this comment.
I tested the PR on Linux and Windows, on GPU and CPU, on a GPU without fp64 (Iris Xe) and with free-threaded Python 3.14t, and the samples match across them. Two comments below: the KS tests without fp64 and a race with threads. Agreed with @antonwolfy on the Raises sections.
dd59c79 to
048cdf3
Compare
Port NumPy's continuous samplers to device kernels: exponential, gamma, beta, chisquare, standard_t, f, lognormal, standard_cauchy, wald, pareto, weibull, power, rayleigh, laplace, gumbel, logistic, triangular and vonmises. The rejection samplers return NaN for device parameters that would make them loop forever.
Also pass the dpnp array straight to assert_allclose in the chisquare test.
Give the Generator methods from lognormal to beta the Parameters, Returns and Examples sections that normal has, with their dtype, usm_type and out defaults. The examples check statistics of 10**5 samples, so they hold for any stream.
6317de6 to
37d8b1e
Compare
This PR adds the continuous distributions to
dpnp.random.Generator, as part of the series splitting #3147. It is stacked on #3157The samplers are device ports of NumPy's algorithms:
exponential,standard_exponential,pareto,weibull,power,rayleighgamma,standard_gamma,beta,chisquare,standard_t,flognormal,standard_cauchy,wald,laplace,gumbel,logistic,triangular,vonmisesParameters on the device aren't checked, since that would wait for the device. The rejection samplers instead return NaN for parameters that would make them loop forever, including valid ones that round badly in single precision