Shortcuts

torch.Tensor.geometric_

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

Fills self 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\}, whereas torch.distributions.geometric.Geometric() (k+1)(k+1)-th trial is the first success hence draws samples in {0,1,}\{0, 1, \ldots\}.

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources