tf.compat.v1.random_poisson
Stay organized with collections
Save and categorize content based on your preferences.
Draws shape
samples from each of the given Poisson distribution(s).
tf.compat.v1.random_poisson(
lam,
shape,
dtype=tf.dtypes.float32
,
seed=None,
name=None
)
lam
is the rate parameter describing the distribution(s).
Example:
samples = tf.random.poisson([0.5, 1.5], [10])
# samples has shape [10, 2], where each slice [:, 0] and [:, 1] represents
# the samples drawn from each distribution
samples = tf.random.poisson([12.2, 3.3], [7, 5])
# samples has shape [7, 5, 2], where each slice [:, :, 0] and [:, :, 1]
# represents the 7x5 samples drawn from each of the two distributions
Args |
lam
|
A Tensor or Python value or N-D array of type dtype .
lam provides the rate parameter(s) describing the poisson
distribution(s) to sample.
|
shape
|
A 1-D integer Tensor or Python array. The shape of the output samples
to be drawn per "rate"-parameterized distribution.
|
dtype
|
The type of the output: float16 , float32 , float64 , int32 or
int64 .
|
seed
|
A Python integer. Used to create a random seed for the distributions.
See
tf.random.set_seed
for behavior.
|
name
|
Optional name for the operation.
|
Returns |
samples
|
a Tensor of shape tf.concat([shape, tf.shape(lam)], axis=0)
with values of type dtype .
|
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 2023-10-06 UTC.
[null,null,["Last updated 2023-10-06 UTC."],[],[],null,["# tf.compat.v1.random_poisson\n\n\u003cbr /\u003e\n\n|------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.14.0/tensorflow/python/ops/random_ops.py#L545-L583) |\n\nDraws `shape` samples from each of the given Poisson distribution(s).\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.poisson`](https://www.tensorflow.org/api_docs/python/tf/compat/v1/random_poisson)\n\n\u003cbr /\u003e\n\n tf.compat.v1.random_poisson(\n lam,\n shape,\n dtype=../../../tf/dtypes#float32,\n seed=None,\n name=None\n )\n\n`lam` is the rate parameter describing the distribution(s).\n\n#### Example:\n\n samples = tf.random.poisson([0.5, 1.5], [10])\n # samples has shape [10, 2], where each slice [:, 0] and [:, 1] represents\n # the samples drawn from each distribution\n\n samples = tf.random.poisson([12.2, 3.3], [7, 5])\n # samples has shape [7, 5, 2], where each slice [:, :, 0] and [:, :, 1]\n # represents the 7x5 samples drawn from each of the two distributions\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|---------|-----------------------------------------------------------------------------------------------------------------------------------------------|\n| `lam` | A Tensor or Python value or N-D array of type `dtype`. `lam` provides the rate parameter(s) describing the poisson distribution(s) to sample. |\n| `shape` | A 1-D integer Tensor or Python array. The shape of the output samples to be drawn per \"rate\"-parameterized distribution. |\n| `dtype` | The type of the output: `float16`, `float32`, `float64`, `int32` or `int64`. |\n| `seed` | A Python integer. Used to create a random seed for the distributions. See [`tf.random.set_seed`](../../../tf/random/set_seed) for behavior. |\n| `name` | Optional name for the operation. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|-----------|----------------------------------------------------------------------------------------------|\n| `samples` | a `Tensor` of shape `tf.concat([shape, tf.shape(lam)], axis=0)` with values of type `dtype`. |\n\n\u003cbr /\u003e"]]