codecamp

TensorFlow函数:tf.random_poisson

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.
tf.random_normal_initializer:TensorFlow初始化器
TensorFlow函数:tf.random_shuffle
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

TensorFlow 函数介绍

TensorFlow 函数模块:tf

TensorFlow的image模块

TensorFlow使用之tf.io

TensorFlow使用之tf.keras

TensorFlow函数教程:tf.keras.applications

TensorFlow函数教程:tf.keras.backend

TensorFlow使用之tf.metrics

TensorFlow使用之tf.nn

TensorFlow使用之tf.python_io

TensorFlow 功能函数

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }