• 文档 >
  • torch >
  • torch.poisson
快捷键

torch.poisson

torch.poisson(input, generator=None) Tensor

返回一个与 input 相同大小的张量,其中每个元素从由 input 中对应元素给出的泊松分布中采样,即,

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

input 必须是非负的。

参数:

输入(张量)- 包含泊松分布率的输入张量

关键字参数:

生成器( 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 贡献者。

使用 Sphinx 构建,并使用 Read the Docs 提供的主题。

文档

PyTorch 的全面开发者文档

查看文档

教程

深入了解初学者和高级开发者的教程

查看教程

资源

查找开发资源并获得您的疑问解答

查看资源