autoray.lazy.random¶
Lazy random array creation.
Classes¶
A lazy random generator, whose draws are lazy arrays that depend on a |
Functions¶
|
Create a lazy random generator. |
|
Create lazy random samples. |
Module Contents¶
- class autoray.lazy.random.LazyGenerator(node, like)[source]¶
A lazy random generator, whose draws are lazy arrays that depend on a single generator node. The concrete generator is created when that node is computed.
- Parameters:
- __slots__ = ('_node', '_like')¶
- _node¶
- _like¶
- property backend¶
- autoray.lazy.random.default_rng(seed=None, backend='numpy', _like=None, **kwargs)[source]¶
Create a lazy random generator.
- Parameters:
seed (None, int, LazyGenerator or backend seed, optional) – Seed passed to the concrete
random.default_rngwhen computed. ALazyGeneratoris returned unchanged.backend (str, optional) – Backend used when
_likeisNone. Defaults to"numpy"._like (LazyArray or None, optional) – Lazy array that supplies the backend, dtype and device at execution.
**kwargs – Options passed to
random.default_rngwhen computed.
- Return type:
- autoray.lazy.random.array(shape, rng=None, backend='numpy', _like=None, **kwargs)[source]¶
Create lazy random samples.
Extra options, such as
dist,dtypeanddevice, are passed torandom_array()when the array is computed.- Parameters:
rng (None, int, LazyGenerator or backend generator, optional) – Passed to
random.arraywhen computed. ALazyGeneratoralso supplies the backend when_likeisNone.backend (str, optional) – Backend used when
_likeandrnggive none. Defaults to"numpy"._like (LazyArray or None, optional) – Lazy array that supplies the backend, dtype and device at execution.
**kwargs – Options passed to
random.arraywhen computed.
- Returns:
Random samples as a lazy array.
- Return type: