从每个给定的泊松分布中抽取 shape 样本。
用法
tf.compat.v1.random_poisson(
lam, shape, dtype=tf.dtypes.float32, seed=None, name=None
)参数
-
lam张量或 Python 值或dtype类型的 N-D 数组。lam提供说明泊松分布的速率参数以进行采样。 -
shape一维整数张量或 Python 数组。每个 "rate" 参数化分布要绘制的输出样本的形状。 -
dtype输出的类型:float16,float32,float64,int32或int64。 -
seed一个 Python 整数。用于为分布创建随机种子。有关行为,请参见tf.random.set_seed。 -
name操作的可选名称。
返回
-
samples形状为tf.concat([shape, tf.shape(lam)], axis=0)的Tensor,其值类型为dtype。
lam 是说明分布的速率参数。
例子:
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
相关用法
- Python tf.compat.v1.random_uniform_initializer.from_config用法及代码示例
- Python tf.compat.v1.random_normal_initializer用法及代码示例
- Python tf.compat.v1.random_normal_initializer.from_config用法及代码示例
- Python tf.compat.v1.random_uniform_initializer用法及代码示例
- Python tf.compat.v1.random.stateless_multinomial用法及代码示例
- Python tf.compat.v1.ragged.constant_value用法及代码示例
- Python tf.compat.v1.reduce_sum用法及代码示例
- Python tf.compat.v1.reduce_any用法及代码示例
- Python tf.compat.v1.reduce_max用法及代码示例
- Python tf.compat.v1.reduce_min用法及代码示例
- Python tf.compat.v1.reduce_all用法及代码示例
- Python tf.compat.v1.reverse_sequence用法及代码示例
- Python tf.compat.v1.reduce_join用法及代码示例
- Python tf.compat.v1.reduce_prod用法及代码示例
- Python tf.compat.v1.reduce_logsumexp用法及代码示例
- Python tf.compat.v1.reduce_mean用法及代码示例
- Python tf.compat.v1.distributions.Multinomial.stddev用法及代码示例
- Python tf.compat.v1.distribute.MirroredStrategy.experimental_distribute_dataset用法及代码示例
- Python tf.compat.v1.data.TFRecordDataset.interleave用法及代码示例
- Python tf.compat.v1.distributions.Bernoulli.cross_entropy用法及代码示例
注:本文由纯净天空筛选整理自tensorflow.org大神的英文原创作品 tf.compat.v1.random_poisson。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。
