Rate this Page

torch.Tensor.geometric_#

Tensor.geometric_(p,*,generator=None)Tensor#

Fillsself tensor with elements drawn from the geometric distribution:

P(X=k)=(1p)k1p,k=1,2,...P(X=k) = (1 - p)^{k - 1} p, k = 1, 2, ...

Note

torch.Tensor.geometric_()k-th trial is the first success hence draws samples in{1,2,}\{1, 2, \ldots\}, whereastorch.distributions.geometric.Geometric()(k+1)(k+1)-th trial is the first successhence draws samples in{0,1,}\{0, 1, \ldots\}.