tfp.substrates.numpy.random.split_seed
Stay organized with collections
Save and categorize content based on your preferences.
Splits a seed into n
derived seeds.
tfp.substrates.numpy.random.split_seed(
seed, n=2, salt=None, name=None
)
See https://github.com/tensorflow/probability/blob/main/PRNGS.md
for details.
Args:
seed: The seed to split; may be an int
, an (int, int) tuple
, or a
Tensor
. int
seeds are converted to Tensor
seeds using
tf.random.stateless_uniform
stateful sampling. Tuples are converted to Tensor
.
n: The number of splits to return. In TensorFlow, if n
is an integer, this
function returns a list of seeds and otherwise returns a Tensor
of
seeds. In JAX, this function always returns an array of seeds.
salt: Optional str
salt to mix with the seed.
name: Optional name to scope related ops.
Returns |
seeds
|
If n is a Python int , a tuple of seed values is returned. If
n is an int Tensor , a single Tensor of shape [n, 2] is returned. A
single such seed is suitable to pass as the seed argument of the
tf.random.stateless_* ops.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2023-11-21 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2023-11-21 UTC."],[],[],null,["# tfp.substrates.numpy.random.split_seed\n\n\u003cbr /\u003e\n\n|--------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/probability/blob/v0.23.0/tensorflow_probability/substrates/numpy/internal/samplers.py#L188-L223) |\n\nSplits a seed into `n` derived seeds.\n\n#### View aliases\n\n\n**Main aliases**\n\n[`tfp.experimental.substrates.numpy.random.split_seed`](https://www.tensorflow.org/probability/api_docs/python/tfp/substrates/numpy/random/split_seed)\n\n\u003cbr /\u003e\n\n tfp.substrates.numpy.random.split_seed(\n seed, n=2, salt=None, name=None\n )\n\nSee https://github.com/tensorflow/probability/blob/main/PRNGS.md\nfor details.\nArgs:\nseed: The seed to split; may be an `int`, an `(int, int) tuple`, or a\n`Tensor`. `int` seeds are converted to `Tensor` seeds using\n[`tf.random.stateless_uniform`](https://www.tensorflow.org/api_docs/python/tf/random/stateless_uniform) stateful sampling. Tuples are converted to `Tensor`.\nn: The number of splits to return. In TensorFlow, if `n` is an integer, this\nfunction returns a list of seeds and otherwise returns a `Tensor` of\nseeds. In JAX, this function always returns an array of seeds.\nsalt: Optional `str` salt to mix with the seed.\nname: Optional name to scope related ops.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `seeds` | If `n` is a Python `int`, a `tuple` of seed values is returned. If `n` is an int `Tensor`, a single `Tensor` of shape `[n, 2]` is returned. A single such seed is suitable to pass as the `seed` argument of the `tf.random.stateless_*` ops. |\n\n\u003cbr /\u003e"]]