tf.random.experimental.stateless_split
bookmark_borderbookmark
Stay organized with collections
Save and categorize content based on your preferences.
Splits an RNG seed into num
new seeds by adding a leading axis.
View aliases
Compat aliases for migration
See
Migration guide for
more details.
tf.compat.v1.random.experimental.stateless_split
tf.random.experimental.stateless_split(
seed, num=2
)
Example:
seed = [1, 2]
new_seeds = tf.random.experimental.stateless_split(seed, num=3)
print(new_seeds)
tf.Tensor(
[[1105988140 1738052849]
[-335576002 370444179]
[ 10670227 -246211131]], shape=(3, 2), dtype=int32)
tf.random.stateless_normal(shape=[3], seed=new_seeds[0, :])
<tf.Tensor: shape=(3,), dtype=float32, numpy=array([-0.59835213, -0.9578608 ,
0.9002807 ], dtype=float32)>
Args |
seed
|
an RNG seed (a tensor with shape [2] and dtype int32 or
int64 ). (When using XLA, only int32 is allowed.)
|
num
|
optional, a positive integer or scalar tensor indicating the number of
seeds to produce (default 2).
|
Returns |
A tensor with shape [num, 2] representing num new seeds. It will have the
same dtype as seed (if seed doesn't have an explict dtype, the dtype
will be determined by tf.convert_to_tensor ).
|
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. Some content is licensed under the numpy license.
Last updated 2021-08-16 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 2021-08-16 UTC."],[],[],null,["# tf.random.experimental.stateless_split\n\n\u003cbr /\u003e\n\n|-------------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.6.0/tensorflow/python/ops/stateless_random_ops.py#L52-L83) |\n\nSplits an RNG seed into `num` new seeds by adding a leading axis.\n\n#### View aliases\n\n\n**Compat aliases for migration**\n\nSee\n[Migration guide](https://www.tensorflow.org/guide/migrate) for\nmore details.\n\n[`tf.compat.v1.random.experimental.stateless_split`](https://www.tensorflow.org/api_docs/python/tf/random/experimental/stateless_split)\n\n\u003cbr /\u003e\n\n tf.random.experimental.stateless_split(\n seed, num=2\n )\n\n#### Example:\n\n seed = [1, 2]\n new_seeds = tf.random.experimental.stateless_split(seed, num=3)\n print(new_seeds)\n tf.Tensor(\n [[1105988140 1738052849]\n [-335576002 370444179]\n [ 10670227 -246211131]], shape=(3, 2), dtype=int32)\n tf.random.stateless_normal(shape=[3], seed=new_seeds[0, :])\n \u003ctf.Tensor: shape=(3,), dtype=float32, numpy=array([-0.59835213, -0.9578608 ,\n 0.9002807 ], dtype=float32)\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|--------|------------------------------------------------------------------------------------------------------------------|\n| `seed` | an RNG seed (a tensor with shape \\[2\\] and dtype `int32` or `int64`). (When using XLA, only `int32` is allowed.) |\n| `num` | optional, a positive integer or scalar tensor indicating the number of seeds to produce (default 2). |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| A tensor with shape \\[num, 2\\] representing `num` new seeds. It will have the same dtype as `seed` (if `seed` doesn't have an explict dtype, the dtype will be determined by [`tf.convert_to_tensor`](../../../tf/convert_to_tensor)). ||\n\n\u003cbr /\u003e"]]