kups.core.utils.random
¶
Random sampling utilities for PyTree structures.
sample_like(sampler, key, tree)
¶
Generate random arrays matching the structure and shapes of a PyTree.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sampler
|
Sampler
|
Function |
required |
key
|
Key
|
JAX PRNG key (split internally for each leaf). |
required |
tree
|
PyTree
|
Template PyTree; each leaf's shape and dtype are matched. |
required |
Returns:
| Type | Description |
|---|---|
PyTree
|
PyTree with the same structure as |