@@ -57,6 +57,22 @@ class RandomState:
57
57
A container for the Mersenne Twister pseudo-random number generator.
58
58
59
59
For full documentation refer to :obj:`numpy.random.RandomState`.
60
+
61
+ Parameters
62
+ ----------
63
+ device : {None, string, SyclDevice, SyclQueue}, optional
64
+ An array API concept of device where the output array is created.
65
+ `device` can be ``None`` (the default), a oneAPI filter selector string,
66
+ an instance of :class:`dpctl.SyclDevice` corresponding to a non-partitioned SYCL device,
67
+ an instance of :class:`dpctl.SyclQueue`, or a `Device` object returned by
68
+ :obj:`dpnp.dpnp_array.dpnp_array.device` property.
69
+ sycl_queue : {None, SyclQueue}, optional
70
+ The SYCL queue to use for output array allocation and copying.
71
+
72
+ Limitations
73
+ -----------
74
+ Parameter `seed` is supported as either a integer scalar or array_like
75
+ of maximumum three integer scalars.
60
76
"""
61
77
62
78
def __init__ (self , seed = None , device = None , sycl_queue = None ):
@@ -107,9 +123,9 @@ def _is_signbit_scalar(self, x):
107
123
108
124
def _validate_float_dtype (self , dtype , supported_types ):
109
125
"""
110
- Test an input floating type if it is listed in `` supported_types` ` and
126
+ Test an input floating type if it is listed in `supported_types` and
111
127
if it is supported by the used SYCL device.
112
- If `` dtype`` is None, default floating type will be validating.
128
+ If `dtype` is `` None`` , default floating type will be validating.
113
129
Return the examined floating type if it follows all validation checks.
114
130
"""
115
131
@@ -139,7 +155,7 @@ def get_state(self):
139
155
140
156
def get_sycl_queue (self ):
141
157
"""
142
- Return an instance of of :class:`dpctl.SyclQueue` used within the generator for data allocation.
158
+ Return an instance of :class:`dpctl.SyclQueue` used within the generator for data allocation.
143
159
144
160
Returns
145
161
-------
@@ -151,7 +167,7 @@ def get_sycl_queue(self):
151
167
152
168
def get_sycl_device (self ):
153
169
"""
154
- Return an instance of of :class:`dpctl.SyclDevice` used within the generator to allocate data on.
170
+ Return an instance of :class:`dpctl.SyclDevice` used within the generator to allocate data on.
155
171
156
172
Returns
157
173
-------
@@ -169,25 +185,24 @@ def normal(self, loc=0.0, scale=1.0, size=None, dtype=None, usm_type="device"):
169
185
170
186
Parameters
171
187
----------
172
- usm_type : ( "device" | "shared" | "host") , optional
188
+ usm_type : { "device", "shared", "host"} , optional
173
189
The type of SYCL USM allocation for the output array.
174
190
175
191
Returns
176
192
-------
177
193
out : dpnp.ndarray
178
194
Drawn samples from the parameterized normal distribution.
179
- Output array data type is the same as input `` dtype`` . If `` dtype`` is None ( default),
180
- :obj:`dpnp.float64` type will be used if device supports it or :obj:`dpnp.float32` otherwise.
195
+ Output array data type is the same as input `dtype`. If `dtype` is `` None`` (the default),
196
+ :obj:`dpnp.float64` type will be used if device supports it, or :obj:`dpnp.float32` otherwise.
181
197
182
198
Limitations
183
199
-----------
184
- Parameters `` loc`` and `` scale` ` are supported as scalar. Otherwise,
200
+ Parameters `loc` and `scale` are supported as scalar. Otherwise,
185
201
:obj:`numpy.random.RandomState.normal(loc, scale, size)` samples are drawn.
186
- Parameter `` dtype`` is supported only for :obj:`dpnp.float32`, :obj:`dpnp.float64` or `None`.
202
+ Parameter `dtype` is supported only as :obj:`dpnp.float32`, :obj:`dpnp.float64` or `` None` `.
187
203
188
204
Examples
189
205
--------
190
- Draw samples from the distribution:
191
206
>>> s = dpnp.random.RandomState().normal(loc=3.7, scale=2.5, size=(2, 4))
192
207
>>> print(s)
193
208
[[ 1.58997253 -0.84288406 2.33836967 4.16394577]
@@ -241,14 +256,14 @@ def rand(self, *args, usm_type="device"):
241
256
242
257
Parameters
243
258
----------
244
- usm_type : ( "device" | "shared" | "host") , optional
259
+ usm_type : { "device", "shared", "host"} , optional
245
260
The type of SYCL USM allocation for the output array.
246
261
247
262
Returns
248
263
-------
249
264
out : dpnp.ndarray
250
265
Random values in a given shape.
251
- Output array data type is :obj:`dpnp.float64` if device supports it or :obj:`dpnp.float32` otherwise.
266
+ Output array data type is :obj:`dpnp.float64` if device supports it, or :obj:`dpnp.float32` otherwise.
252
267
253
268
Examples
254
269
--------
@@ -284,21 +299,21 @@ def randint(self, low, high=None, size=None, dtype=int, usm_type="device"):
284
299
285
300
Parameters
286
301
----------
287
- usm_type : ( "device" | "shared" | "host") , optional
302
+ usm_type : { "device", "shared", "host"} , optional
288
303
The type of SYCL USM allocation for the output array.
289
304
290
305
Returns
291
306
-------
292
307
out : dpnp.ndarray
293
308
`size`-shaped array of random integers from the appropriate distribution,
294
- or a single such random int if `size` not provided.
295
- Output array data type is the same as input `` dtype` `.
309
+ or a single such random int if `size` is not provided.
310
+ Output array data type is the same as input `dtype`.
296
311
297
312
Limitations
298
313
-----------
299
- Parameters `` low`` and `` high`` are supported only as scalar.
300
- Parameter `` dtype`` is supported only as :obj:`dpnp.int32` or `int`,
301
- but `int` value is considered to be exactly equivalent to :obj:`dpnp.int32`.
314
+ Parameters `low` and `high` are supported only as a scalar.
315
+ Parameter `dtype` is supported only as :obj:`dpnp.int32` or `` int` `,
316
+ but `` int` ` value is considered to be exactly equivalent to :obj:`dpnp.int32`.
302
317
Otherwise, :obj:`numpy.random.randint(low, high, size, dtype)` samples are drawn.
303
318
304
319
Examples
@@ -359,16 +374,16 @@ def randn(self, *args, usm_type="device"):
359
374
360
375
Parameters
361
376
----------
362
- usm_type : ( "device" | "shared" | "host") , optional
377
+ usm_type : { "device", "shared", "host"} , optional
363
378
The type of SYCL USM allocation for the output array.
364
379
365
380
Returns
366
381
-------
367
- Z : dpnp.ndarray
382
+ out : dpnp.ndarray
368
383
A ``(d0, d1, ..., dn)``-shaped array of floating-point samples from
369
384
the standard normal distribution, or a single such float if
370
385
no parameters were supplied.
371
- Output array data type is :obj:`dpnp.float64` if device supports it
386
+ Output array data type is :obj:`dpnp.float64` if device supports it,
372
387
or :obj:`dpnp.float32` otherwise.
373
388
374
389
Examples
@@ -408,15 +423,15 @@ def random_sample(self, size=None, usm_type="device"):
408
423
409
424
Parameters
410
425
----------
411
- usm_type : ( "device" | "shared" | "host") , optional
426
+ usm_type : { "device", "shared", "host"} , optional
412
427
The type of SYCL USM allocation for the output array.
413
428
414
429
Returns
415
430
-------
416
431
out : dpnp.ndarray
417
432
Array of random floats of shape `size` (if ``size=None``,
418
433
zero dimension array with a single float is returned).
419
- Output array data type is :obj:`dpnp.float64` if device supports it
434
+ Output array data type is :obj:`dpnp.float64` if device supports it,
420
435
or :obj:`dpnp.float32` otherwise.
421
436
422
437
Examples
@@ -447,20 +462,19 @@ def standard_normal(self, size=None, usm_type="device"):
447
462
448
463
Parameters
449
464
----------
450
- usm_type : ( "device" | "shared" | "host") , optional
465
+ usm_type : { "device", "shared", "host"} , optional
451
466
The type of SYCL USM allocation for the output array.
452
467
453
468
Returns
454
469
-------
455
470
out : dpnp.ndarray
456
- A floating-point array of shape `` size` ` of drawn samples, or a
457
- single sample if `` size` ` was not specified.
458
- Output array data type is :obj:`dpnp.float64` if device supports it
471
+ A floating-point array of shape `size` of drawn samples, or a
472
+ single sample if `size` was not specified.
473
+ Output array data type is :obj:`dpnp.float64` if device supports it,
459
474
or :obj:`dpnp.float32` otherwise.
460
475
461
476
Examples
462
477
--------
463
- Draw samples from the distribution:
464
478
>>> s = dpnp.random.RandomState().standard_normal(size=(3, 5))
465
479
>>> print(s)
466
480
[[-0.84401099 -1.81715362 -0.54465213 0.18557831 0.28352814]
@@ -492,25 +506,24 @@ def uniform(self, low=0.0, high=1.0, size=None, dtype=None, usm_type="device"):
492
506
493
507
Parameters
494
508
----------
495
- usm_type : ( "device" | "shared" | "host") , optional
509
+ usm_type : { "device", "shared", "host"} , optional
496
510
The type of SYCL USM allocation for the output array.
497
511
498
512
Returns
499
513
-------
500
514
out : dpnp.ndarray
501
515
Drawn samples from the parameterized uniform distribution.
502
- Output array data type is the same as input `` dtype`` . If `` dtype`` is None ( default),
503
- :obj:`dpnp.float64` type will be used if device supports it or :obj:`dpnp.float32` otherwise.
516
+ Output array data type is the same as input `dtype`. If `dtype` is `` None`` (the default),
517
+ :obj:`dpnp.float64` type will be used if device supports it, or :obj:`dpnp.float32` otherwise.
504
518
505
519
Limitations
506
520
-----------
507
- Parameters `` low`` and `` high` ` are supported as scalar. Otherwise,
521
+ Parameters `low` and `high` are supported as scalar. Otherwise,
508
522
:obj:`numpy.random.uniform(low, high, size)` samples are drawn.
509
- Parameter `` dtype`` is supported only for :obj:`dpnp.int32`, :obj:`dpnp.float32`, :obj:`dpnp.float64` or `None`.
523
+ Parameter `dtype` is supported only as :obj:`dpnp.int32`, :obj:`dpnp.float32`, :obj:`dpnp.float64` or `` None` `.
510
524
511
525
Examples
512
526
--------
513
- Draw samples from the distribution:
514
527
>>> low, high = 1.23, 10.54 # low and high
515
528
>>> s = dpnp.random.RandomState().uniform(low, high, 5)
516
529
>>> print(s)
0 commit comments