快捷方式

torch.poisson

torch.poisson(input, generator=None) Tensor

返回一個與 input 大小相同的張量,其中每個元素的取樣來自於泊松分佈,其速率引數由 input 中對應的元素給出,即

outiPoisson(inputi)\text{out}_i \sim \text{Poisson}(\text{input}_i)

input 必須是非負的。

引數

input (Tensor) – 包含泊松分佈速率的輸入張量

關鍵字引數

generator (torch.Generator, 可選的) – 用於取樣的偽隨機數生成器

示例

>>> rates = torch.rand(4, 4) * 5  # rate parameter between 0 and 5
>>> torch.poisson(rates)
tensor([[9., 1., 3., 5.],
        [8., 6., 6., 0.],
        [0., 4., 5., 3.],
        [2., 1., 4., 2.]])

文件

訪問 PyTorch 的全面開發者文件

檢視文件

教程

獲取針對初學者和高階開發者的深度教程

檢視教程

資源

查詢開發資源並獲得問題解答

檢視資源