TensorFlow函数:tf.random_poisson

2018-11-25 11:24 更新
tf.random_poisson 函数
random_poisson(
    lam,
    shape,
    dtype=tf.float32,
    seed=None,
    name=None
)

定义在:tensorflow/python/ops/random_ops.py.

从每个给定的 Poisson 分布中绘制 shape 的样本.

该函数中的 lam 参数是描述该分布的速率参数.

如下示例:

samples = tf.random_poisson([0.5, 1.5], [10]) 
# samples 的形状为 [10, 2], 其中每个 slice [:, 0] 和 [:, 1] 表示从每个分布中抽取的样本
samples = tf.random_poisson([12.2, 3.3], [7, 5]) 
# samples 的形状为 [7, 5, 2], 其中每个 slice [:, :, 0] 和 [:, :, 1] 表示从两个分布的其中一个提取的 7x5 样本

参数:

  • lam:一个张量或者 Python 值或者 dtype 类型的 N-D 数组 .lam 提供描述要采样的 Poisson 分布的速率参数.
  • shape:一维整数张量或 Python 数组.输出样本的形状按照 “速率” - 参数化分布绘制.
  • dtype:lam 和输出的类型:float16,float32 或 float64.
  • seed:一个 Python 整数.用于为分布创建一个随机种子.查看 tf.set_random_seed 行为.
  • name:操作的可选名称.

返回:

  • samples:形状为 tf.concat(shape, tf.shape(lam)) 并且具有 dtype 类型值的 Tensor.
以上内容是否对您有帮助:
在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy